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-1/

Transaction Draft Builder

A helper that turns user-friendly payment parameters into a network-ready Ethereum transaction draft with a signing payload. It should lean on the dependency's transaction-building helpers to fill network defaults and handle serialization rather than reimplementing low-level encoding by hand.

Capabilities

Populate Fees and Type

  • When the network reports a base fee of 30 gwei and a suggested tip of 2 gwei, a request without fee fields returns a type-2 draft that fills those values and omits any legacy gas price. @test
  • When the caller supplies a legacy gas price of 15 gwei and no base fee is available, the draft keeps that value and marks the transaction as legacy. @test

Resolve Sender and Basic Fields

  • If from is provided as index 1 and available accounts are ["0xabc...", "0xdef..."], the draft uses the second account with checksum casing and sets nonce and gas based on RPC responses. @test
  • Contract creation requests with no to field still include chainId, nonce, gas, and data in the prepared draft. @test

Build Signing Payload

  • The helper outputs a hex signing payload that matches the prepared transaction fields and prefixes 0x, suitable for offline signing. @test

Implementation

@generates

API

export interface DraftRequest {
  /** Ethereum client from the dependency package, already configured with a provider */
  client: any;
  /** Sender address or zero-based index into `availableAccounts` */
  from: string | number;
  /** Destination address, optional for contract creation */
  to?: string;
  /** Decimal or hex wei value to transfer */
  value: string | bigint;
  /** Optional calldata for the transaction */
  data?: string;
  /** Optional gas price in wei for legacy transactions */
  gasPrice?: string | bigint;
  /** Optional EIP-1559 priority fee override in wei */
  maxPriorityFeePerGas?: string | bigint;
  /** Optional EIP-1559 max fee override in wei */
  maxFeePerGas?: string | bigint;
  /** Optional list of known accounts to resolve numeric indices */
  availableAccounts?: string[];
}

export interface DraftResult {
  /** Prepared transaction object with numeric fields serialized for signing */
  prepared: Record<string, any>;
  /** Hex string to be passed to a signer */
  signingPayload: string;
  /** Basic summary for convenience */
  summary: {
    type: 'eip1559' | 'legacy';
    from: string;
    to?: string;
    gas: string;
    value: string;
  };
}

/**
 * Builds a ready-to-sign Ethereum transaction draft using the transaction assembly helpers
 * provided by the dependency package.
 */
export async function buildTransactionDraft(request: DraftRequest): Promise<DraftResult>;

Dependencies { .dependencies }

web3-eth { .dependency }

Ethereum JSON-RPC client with transaction assembly helpers from its transaction building utilities.

tessl i tessl/npm-web3-eth@4.8.0

tile.json