signAuthorization
Signs an unsigned authorization using the provided private key account.
Import
Usage
import { class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount | LocalAccount>Represents a local account signer and provides methods to sign messages and transactions, as well as static methods to create the signer from mnemonic or private key.
LocalAccountSigner } from "@aa-sdk/core";
import { function generatePrivateKey(): HexgeneratePrivateKey } from "viem/accounts";
const const signer: LocalAccountSigner<{
address: Address;
nonceManager?: NonceManager | undefined;
sign: (parameters: {
hash: Hash;
}) => Promise<Hex>;
... 6 more ...;
type: "local";
}>signer =
class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount | LocalAccount>Represents a local account signer and provides methods to sign messages and transactions, as well as static methods to create the signer from mnemonic or private key.
LocalAccountSigner.LocalAccountSigner<T extends HDAccount | PrivateKeyAccount | LocalAccount>.privateKeyToAccountSigner(key: Hex): LocalAccountSigner<PrivateKeyAccount>Creates a LocalAccountSigner
instance using the provided private key.
privateKeyToAccountSigner(function generatePrivateKey(): HexgeneratePrivateKey());
const const signedAuthorization: Authorization<number, true>signedAuthorization = await const signer: LocalAccountSigner<{
address: Address;
nonceManager?: NonceManager | undefined;
sign: (parameters: {
hash: Hash;
}) => Promise<Hex>;
... 6 more ...;
type: "local";
}>signer.LocalAccountSigner<{ address: Address; nonceManager?: NonceManager | undefined; sign: (parameters: { hash: Hash; }) => Promise<Hex>; ... 6 more ...; type: "local"; }>.signAuthorization(this: LocalAccountSigner<PrivateKeyAccount>, unsignedAuthorization: Authorization<number, false>): Promise<Authorization<number, true>>Signs an unsigned authorization using the provided private key account.
signAuthorization({
contractAddress: stringcontractAddress: "0x1234123412341234123412341234123412341234",
chainId: numberChain ID.
chainId: 1,
nonce: numberNonce of the EOA to delegate to.
nonce: 3,
});
Parameters
unsignedAuthorization
AuthorizationRequest<number>
- The unsigned authorization to be signed.
Returns
Promise<SignedAuthorization<number>>
A promise that resolves to the signed authorization.