Create a server wallet for sending transactions and signing messages via engine (v3+).
import { Engine } from "thirdweb"; const client = createThirdwebClient({ secretKey: "<your-project-secret-key>",}); const myServerWallet = Engine.serverWallet({ client, address: "<your-server-wallet-address>", vaultAccessToken: "<your-vault-access-token>",});
// prepare the transactionconst transaction = claimTo({ contract, to: "0x...", quantity: 1n,}); // enqueue the transactionconst { transactionId } = await myServerWallet.enqueueTransaction({ transaction,});
// optionally poll for the transaction to be submitted onchainconst { transactionHash } = await Engine.waitForTransactionHash({ client, transactionId,});console.log("Transaction sent:", transactionHash);
const executionResult = await Engine.getTransactionStatus({ client, transactionId,});console.log("Transaction status:", executionResult.status);
function serverWallet(options: ServerWalletOptions): ServerWallet;
The server wallet options.
let options: { address: string; chain?: Chain; client: ThirdwebClient; executionOptions?: | Omit<AaExecutionOptions, "chainId"> | Omit<AaZksyncExecutionOptions, "chainId">; vaultAccessToken: string;};
let returnType: Account & { enqueueTransaction: (args: { simulate?: boolean; transaction: PreparedTransaction; }) => Promise<{ transactionId: string }>;};
An account object that can be used to send transactions and sign messages.