Skip to content

signTransaction

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

Import

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

Usage

import { AlchemyWebSigner } from "@account-kit/signer";
 
const signer = new AlchemyWebSigner({
  client: {
    connection: {
      rpcUrl: "/api/rpc",
    },
    iframeConfig: {
      iframeContainerId: "alchemy-signer-iframe-container",
    },
  },
});
 
const tx = await signer.signTransaction({
  to: "0x1234",
  value: "0x1234",
  data: "0x1234",
});

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