CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-web3-eth

Web3 module to interact with the Ethereum blockchain and smart contracts.

Agent Success

Agent success rate when using this tile

67%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.99x

Baseline

Agent success rate without this tile

68%

Overview
Eval results
Files

task.mdevals/scenario-3/

Offline Signing Toolkit

Utility functions for offline signing of Ethereum personal messages, EIP-712 typed data, and EIP-1559 transactions using a provided private key.

Capabilities

Personal message signatures

  • Signing the UTF-8 message "Authenticate me" with private key 0x4c0883a69102937d6231471b5dbb6204fe512961708279b6f0e6a5c4f8b9e3fa returns a 65-byte hex signature and the prefixed message hash; recovering the signer yields 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1. @test
  • Empty message input is rejected with a clear error that explains why signing was not attempted. @test

Typed data signatures

  • Signing the EIP-712 payload with primaryType: "Mail", domain { name: "Mail", version: "1", chainId: 1, verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" }, types Person(name,string; wallet,address) and Mail(from,Person; to,Person; contents,string), and message { from: { name: "Cow", wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826" }, to: { name: "Bob", wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" }, contents: "Hello, Bob!" } using the same private key returns a signature that verifies to 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1 and exposes the typed data digest. @test
  • Payloads missing a primaryType or domain.chainId are rejected with explicit validation errors before signing. @test

Transaction envelope signatures

  • Signing an EIP-1559 transfer with to: 0x000000000000000000000000000000000000dEaD, value: 0x2386f26fc10000 (0.01 ETH), nonce: 7, gasLimit: 0x5208, maxFeePerGas: 0x59682f00, maxPriorityFeePerGas: 0x3b9aca00, chainId: 1, and no data using the same private key produces a type-2 raw transaction whose decoded sender is 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1 and transaction hash matches the signed payload. @test
  • Signing attempts missing gasLimit or either fee cap are rejected with explicit errors instead of producing a malformed raw transaction. @test

Implementation

@generates

API

export type HexString = `0x${string}`;

export interface PersonalSignResult {
  address: HexString;
  messageHash: HexString;
  signature: HexString;
}

export interface TypedDataDomain {
  name: string;
  version: string;
  chainId: number;
  verifyingContract: HexString;
}

export interface TypedDataType {
  name: string;
  type: string;
}

export interface TypedDataPayload {
  domain: TypedDataDomain;
  primaryType: string;
  types: Record<string, TypedDataType[]>;
  message: Record<string, unknown>;
}

export interface TypedSignResult {
  address: HexString;
  digest: HexString;
  signature: HexString;
}

export interface TransactionEnvelope {
  privateKey: HexString;
  to: HexString;
  value: HexString;
  nonce: number;
  gasLimit: HexString;
  maxFeePerGas: HexString;
  maxPriorityFeePerGas: HexString;
  chainId: number;
  data?: HexString;
}

export interface TransactionSignResult {
  from: HexString;
  rawTransaction: HexString;
  transactionHash: HexString;
}

export function signPersonalMessage(input: { privateKey: HexString; message: string | Uint8Array }): Promise<PersonalSignResult>;

export function signTypedData(input: { privateKey: HexString; payload: TypedDataPayload }): Promise<TypedSignResult>;

export function signTransactionEnvelope(input: TransactionEnvelope): Promise<TransactionSignResult>;

Dependencies { .dependencies }

web3-eth { .dependency }

Provides Ethereum signing, hashing, and transaction encoding utilities needed for personal messages, EIP-712 typed data, and EIP-1559 envelopes.

tessl i tessl/npm-web3-eth@4.8.0

tile.json