signTransaction

Serializes a transaction, signs it with a raw message, and then returns the serialized transaction with the signature.

Import

1import { BaseAlchemySigner } from "@account-kit/signer";

Usage

1import { AlchemyWebSigner } from "@account-kit/signer";
2
3const signer = new AlchemyWebSigner({
4 client: {
5 connection: {
6 rpcUrl: "/api/rpc",
7 },
8 iframeConfig: {
9 iframeContainerId: "alchemy-signer-iframe-container",
10 },
11 },
12});
13
14const tx = await signer.signTransaction({
15 to: "0x1234",
16 value: "0x1234",
17 data: "0x1234",
18});

Parameters

tx

Transaction the transaction to be serialized and signed

args

{serializer?: SerializeTransactionFn} options for serialization

args.serializer

() => Hex an optional serializer function. If not provided, the default serializeTransaction function will be used

Returns

Promise<string> a promise that resolves to the serialized transaction with the signature