CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-ledgerhq--hw-app-eth

Ledger Hardware Wallet Ethereum Application API that enables developers to integrate Ledger wallet support into Ethereum applications for address generation, transaction signing, message signing, and various Ethereum operations.

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

core-operations.mddocs/

Core Operations

Essential hardware wallet operations including address generation, app configuration, basic device interaction, and challenge-based authentication.

Capabilities

Eth Class Constructor

Creates a new Ethereum application instance with transport and optional configuration.

/**
 * Creates a new Ethereum application instance
 * @param transport - Hardware wallet transport instance
 * @param scrambleKey - Optional scramble key for transport encryption (default: "w0w")
 * @param loadConfig - Optional service configuration for transaction resolution
 */
constructor(transport: Transport, scrambleKey?: string, loadConfig?: LoadConfig);

Usage Example:

import Transport from "@ledgerhq/hw-transport-node-hid";
import Eth from "@ledgerhq/hw-app-eth";

const transport = await Transport.create();
const eth = new Eth(transport);

// With custom configuration
const eth = new Eth(transport, "w0w", {
  nftExplorerBaseURL: "https://nft-explorer.api.com",
  pluginBaseURL: "https://plugin.api.com"
});

Address Generation

Get Ethereum addresses for BIP32 derivation paths with optional display and chaincode features.

/**
 * Get Ethereum address for a given BIP 32 path
 * @param path - BIP32 derivation path (e.g., "44'/60'/0'/0/0")
 * @param boolDisplay - Optionally display address on device screen
 * @param boolChaincode - Optionally return the chaincode
 * @param chainId - Optionally display network name on Stax devices
 * @returns Object containing publicKey, address, and optional chainCode
 */
getAddress(
  path: string,
  boolDisplay?: boolean,
  boolChaincode?: boolean,
  chainId?: string
): Promise<{
  publicKey: string;
  address: string;
  chainCode?: string;
}>;

Usage Examples:

// Basic address generation
const result = await eth.getAddress("44'/60'/0'/0/0");
console.log(result.address); // "0x..."
console.log(result.publicKey); // Public key hex string

// Display address on device
const result = await eth.getAddress("44'/60'/0'/0/0", true);

// Get address with chaincode
const result = await eth.getAddress("44'/60'/0'/0/0", false, true);
console.log(result.chainCode); // Chain code for key derivation

// Display network on Stax device (Ethereum mainnet)
const result = await eth.getAddress("44'/60'/0'/0/0", true, false, "1");

App Configuration

Retrieve configuration and capabilities of the Ethereum application on the hardware wallet.

/**
 * Get Ethereum app configuration and supported features
 * @returns Configuration object with feature flags and version
 */
getAppConfiguration(): Promise<{
  arbitraryDataEnabled: number;
  erc20ProvisioningNecessary: number;
  starkEnabled: number;
  starkv2Supported: number;
  version: string;
}>;

Usage Example:

const config = await eth.getAppConfiguration();

console.log(config.version); // "1.10.3"
console.log(config.arbitraryDataEnabled); // 1 if enabled, 0 if disabled
console.log(config.starkEnabled); // 1 if StarkEx is supported
console.log(config.erc20ProvisioningNecessary); // 1 if ERC20 tokens need provisioning

// Check for specific features
if (config.arbitraryDataEnabled) {
  console.log("Contract data signing is enabled");
}

if (config.starkv2Supported) {
  console.log("StarkEx v2 operations are supported");
}

Service Configuration

Set or update the service configuration for transaction resolution and metadata loading.

/**
 * Set load configuration for transaction resolution services
 * @param loadConfig - Configuration object for various services
 */
setLoadConfig(loadConfig: LoadConfig): void;

Usage Example:

// Update service configuration
eth.setLoadConfig({
  nftExplorerBaseURL: "https://custom-nft-api.com",
  pluginBaseURL: "https://custom-plugin-api.com",
  cryptoassetsBaseURL: "https://custom-crypto-api.com",
  calServiceURL: "https://custom-cal-api.com",
  extraPlugins: { 
    customPlugin: "custom-data" 
  }
});

// Clear specific configuration
eth.setLoadConfig({
  nftExplorerBaseURL: null,
  pluginBaseURL: null
});

Challenge Authentication

Get authentication challenge from the hardware wallet for secure operations.

/**
 * Get challenge for authentication from the hardware wallet
 * @returns Challenge string for authentication
 */
getChallenge(): Promise<string>;

Usage Example:

const challenge = await eth.getChallenge();
console.log(challenge); // Challenge hex string

// Use challenge for authentication workflow
const authData = {
  challenge: challenge,
  timestamp: Date.now()
};

Core Types

interface LoadConfig {
  /** Base URL for NFT metadata service */
  nftExplorerBaseURL?: string | null;
  /** Base URL for plugin loading service */
  pluginBaseURL?: string | null;
  /** Additional plugin configuration */
  extraPlugins?: any | null;
  /** Base URL for crypto assets metadata service */
  cryptoassetsBaseURL?: string | null;
  /** Base URL for Clear Application Language service */
  calServiceURL?: string | null;
}

docs

advanced-features.md

core-operations.md

index.md

message-signing.md

services-utilities.md

starkex.md

transaction-signing.md

tile.json