MCPcopy Create free account
hub / github.com/etherspot/transaction-kit / signMessage

Method signMessage

lib/TransactionKit.ts:694–787  ·  view source on GitHub ↗
({ message }: { message: SignableMessage })

Source from the content-addressed store, hash-verified

692 const eip6492Account: LocalAccount<string, Address> = {
693 ...owner,
694 async signMessage({ message }: { message: SignableMessage }) {
695 // First, get the standard signature from the underlying account
696 // This will delegate to WalletConnect/MetaMask/provider if the owner account is provider-based
697 const standardSignature = await walletClient.signMessage({
698 account: owner,
699 message: message as string,
700 });
701
702 // Get or create the authorization
703 const isAlreadyInstalled =
704 await self.isDelegateSmartAccountToEoa(signChainId);
705
706 let authorization: SignAuthorizationReturnType | undefined;
707
708 // Get authorization for EIP-6492 wrapper
709 // We always need authorization data for the EIP-6492 signature format,
710 // regardless of whether the account is already installed or not
711 if (!isAlreadyInstalled) {
712 // When not installed, use delegateSmartAccountToEoa to get authorization
713 // This ensures proper initialization and state management
714 const delegateResult = await self.delegateSmartAccountToEoa({
715 chainId: signChainId,
716 delegateImmediately: false,
717 });
718
719 if (!delegateResult.authorization) {
720 throw new Error(
721 'Failed to create authorization for EIP-6492 signature'
722 );
723 }
724
725 authorization = delegateResult.authorization;
726 } else {
727 // When already installed, sign authorization directly
728 const delegateAddress = KernelVersionToAddressesMap[KERNEL_V3_3]
729 .accountImplementationAddress as `0x${string}`;
730
731 authorization = await bundlerClient.signAuthorization({
732 account: owner,
733 contractAddress: delegateAddress,
734 });
735 }
736
737 if (!authorization) {
738 throw new Error(
739 'Failed to create authorization for EIP-6492 signature. ' +
740 'This may be due to network issues, bundler API problems, or account configuration. ' +
741 'Please check your network connection and bundler API key, or try again later.'
742 );
743 }
744
745 // Encode authorization for EIP-7702
746 // Normalize authorization fields and provide safe fallbacks
747 const authChainIdHex = toHex(authorization.chainId);
748 const authNonceHex = toHex(authorization.nonce);
749 const authVHex = toHex(authorization.v ?? 0);
750 const authR = authorization.r;
751 const authS = authorization.s;

Callers

nothing calls this directly

Calls 9

throwErrorMethod · 0.95
createEIP6492AccountMethod · 0.95
logFunction · 0.90
getWalletModeMethod · 0.80
getChainIdMethod · 0.80
getOwnerAccountMethod · 0.80
signMessageMethod · 0.65

Tested by

no test coverage detected