Class ServerWallet
- Namespace
- Thirdweb
- Assembly
- Thirdweb.dll
Interact with vault-secured server wallets created from the Thirdweb project dashboard's Transactions tab.
public class ServerWallet : IThirdwebWallet
- Inheritance
-
ServerWallet
- 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, ExecutionOptions, string)
Creates an instance of the ServerWallet.
public static Task<ServerWallet> Create(ThirdwebClient client, string label, ExecutionOptions executionOptions = null, string vaultAccessToken = null)
Parameters
clientThirdwebClientThe Thirdweb client.
labelstringThe label of your created server wallet.
executionOptionsExecutionOptionsThe execution options for the server wallet, defaults to auto if not passed.
vaultAccessTokenstringThe vault access token for the server wallet if self-managed.
Returns
- Task<ServerWallet>
A new instance of the ServerWallet.
Exceptions
- ArgumentNullException
Thrown when client or label is null or empty.
- InvalidOperationException
Thrown when no server wallets are found or the specified label does not match any existing server wallet.
Disconnect()
Disconnects the wallet (if using InAppWallet, clears session)
public Task Disconnect()
Returns
ExecuteTransaction(ThirdwebTransactionInput)
Sends a transaction and waits for its receipt.
public Task<ThirdwebTransactionReceipt> ExecuteTransaction(ThirdwebTransactionInput transactionInput)
Parameters
transactionInputThirdwebTransactionInput
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)
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)
Parameters
walletToLinkIThirdwebWalletThe wallet to link.
otpstringThe OTP code if the wallet to link is an email or phone wallet.
isMobilebool?Set to true if linking OAuth on mobile.
browserOpenActionAction<string>The action to open the browser if linking OAuth.
mobileRedirectSchemestringThe redirect scheme if linking OAuth on mobile.
browserIThirdwebBrowserThe browser to use if linking OAuth.
chainIdBigInteger?The chain ID if linking an external wallet (SIWE).
jwtstringThe JWT token if linking custom JWT auth.
payloadstringThe login payload if linking custom AuthEndpoint auth.
defaultSessionIdOverridestringThe default session ID override if linking Guest 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
rawMessagebyte[]The raw message to sign.
Returns
PersonalSign(string)
Signs a message using personal signing.
public Task<string> PersonalSign(string message)
Parameters
messagestringThe message to sign.
Returns
SendTransaction(ThirdwebTransactionInput)
Sends a transaction.
public Task<string> SendTransaction(ThirdwebTransactionInput transaction)
Parameters
transactionThirdwebTransactionInputThe 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
chainIdBigIntegerThe chain ID of the contract.
contractAddressstringThe address of the contract.
willSelfExecuteboolSet 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
transactionThirdwebTransactionInputThe transaction to sign.
Returns
SignTypedDataV4(string)
Signs typed data (version 4).
public Task<string> SignTypedDataV4(string json)
Parameters
jsonstringThe 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
dataTThe data to sign.
typedDataTypedData<TDomain>The typed data.
Returns
Type Parameters
TThe type of the data.
TDomainThe type of the domain.
SwitchNetwork(BigInteger)
Attempts to set the active network to the specified chain ID.
public Task SwitchNetwork(BigInteger chainId)
Parameters
chainIdBigIntegerThe 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
accountToUnlinkLinkedAccountThe linked account to unlink. Same type returned by GetLinkedAccounts().
Returns
WaitForTransactionHash(string)
public Task<string> WaitForTransactionHash(string txid)
Parameters
txidstring