0
# Core Operations
1
2
Essential hardware wallet operations including address generation, app configuration, basic device interaction, and challenge-based authentication.
3
4
## Capabilities
5
6
### Eth Class Constructor
7
8
Creates a new Ethereum application instance with transport and optional configuration.
9
10
```typescript { .api }
11
/**
12
* Creates a new Ethereum application instance
13
* @param transport - Hardware wallet transport instance
14
* @param scrambleKey - Optional scramble key for transport encryption (default: "w0w")
15
* @param loadConfig - Optional service configuration for transaction resolution
16
*/
17
constructor(transport: Transport, scrambleKey?: string, loadConfig?: LoadConfig);
18
```
19
20
**Usage Example:**
21
22
```typescript
23
import Transport from "@ledgerhq/hw-transport-node-hid";
24
import Eth from "@ledgerhq/hw-app-eth";
25
26
const transport = await Transport.create();
27
const eth = new Eth(transport);
28
29
// With custom configuration
30
const eth = new Eth(transport, "w0w", {
31
nftExplorerBaseURL: "https://nft-explorer.api.com",
32
pluginBaseURL: "https://plugin.api.com"
33
});
34
```
35
36
### Address Generation
37
38
Get Ethereum addresses for BIP32 derivation paths with optional display and chaincode features.
39
40
```typescript { .api }
41
/**
42
* Get Ethereum address for a given BIP 32 path
43
* @param path - BIP32 derivation path (e.g., "44'/60'/0'/0/0")
44
* @param boolDisplay - Optionally display address on device screen
45
* @param boolChaincode - Optionally return the chaincode
46
* @param chainId - Optionally display network name on Stax devices
47
* @returns Object containing publicKey, address, and optional chainCode
48
*/
49
getAddress(
50
path: string,
51
boolDisplay?: boolean,
52
boolChaincode?: boolean,
53
chainId?: string
54
): Promise<{
55
publicKey: string;
56
address: string;
57
chainCode?: string;
58
}>;
59
```
60
61
**Usage Examples:**
62
63
```typescript
64
// Basic address generation
65
const result = await eth.getAddress("44'/60'/0'/0/0");
66
console.log(result.address); // "0x..."
67
console.log(result.publicKey); // Public key hex string
68
69
// Display address on device
70
const result = await eth.getAddress("44'/60'/0'/0/0", true);
71
72
// Get address with chaincode
73
const result = await eth.getAddress("44'/60'/0'/0/0", false, true);
74
console.log(result.chainCode); // Chain code for key derivation
75
76
// Display network on Stax device (Ethereum mainnet)
77
const result = await eth.getAddress("44'/60'/0'/0/0", true, false, "1");
78
```
79
80
### App Configuration
81
82
Retrieve configuration and capabilities of the Ethereum application on the hardware wallet.
83
84
```typescript { .api }
85
/**
86
* Get Ethereum app configuration and supported features
87
* @returns Configuration object with feature flags and version
88
*/
89
getAppConfiguration(): Promise<{
90
arbitraryDataEnabled: number;
91
erc20ProvisioningNecessary: number;
92
starkEnabled: number;
93
starkv2Supported: number;
94
version: string;
95
}>;
96
```
97
98
**Usage Example:**
99
100
```typescript
101
const config = await eth.getAppConfiguration();
102
103
console.log(config.version); // "1.10.3"
104
console.log(config.arbitraryDataEnabled); // 1 if enabled, 0 if disabled
105
console.log(config.starkEnabled); // 1 if StarkEx is supported
106
console.log(config.erc20ProvisioningNecessary); // 1 if ERC20 tokens need provisioning
107
108
// Check for specific features
109
if (config.arbitraryDataEnabled) {
110
console.log("Contract data signing is enabled");
111
}
112
113
if (config.starkv2Supported) {
114
console.log("StarkEx v2 operations are supported");
115
}
116
```
117
118
### Service Configuration
119
120
Set or update the service configuration for transaction resolution and metadata loading.
121
122
```typescript { .api }
123
/**
124
* Set load configuration for transaction resolution services
125
* @param loadConfig - Configuration object for various services
126
*/
127
setLoadConfig(loadConfig: LoadConfig): void;
128
```
129
130
**Usage Example:**
131
132
```typescript
133
// Update service configuration
134
eth.setLoadConfig({
135
nftExplorerBaseURL: "https://custom-nft-api.com",
136
pluginBaseURL: "https://custom-plugin-api.com",
137
cryptoassetsBaseURL: "https://custom-crypto-api.com",
138
calServiceURL: "https://custom-cal-api.com",
139
extraPlugins: {
140
customPlugin: "custom-data"
141
}
142
});
143
144
// Clear specific configuration
145
eth.setLoadConfig({
146
nftExplorerBaseURL: null,
147
pluginBaseURL: null
148
});
149
```
150
151
### Challenge Authentication
152
153
Get authentication challenge from the hardware wallet for secure operations.
154
155
```typescript { .api }
156
/**
157
* Get challenge for authentication from the hardware wallet
158
* @returns Challenge string for authentication
159
*/
160
getChallenge(): Promise<string>;
161
```
162
163
**Usage Example:**
164
165
```typescript
166
const challenge = await eth.getChallenge();
167
console.log(challenge); // Challenge hex string
168
169
// Use challenge for authentication workflow
170
const authData = {
171
challenge: challenge,
172
timestamp: Date.now()
173
};
174
```
175
176
## Core Types
177
178
```typescript { .api }
179
interface LoadConfig {
180
/** Base URL for NFT metadata service */
181
nftExplorerBaseURL?: string | null;
182
/** Base URL for plugin loading service */
183
pluginBaseURL?: string | null;
184
/** Additional plugin configuration */
185
extraPlugins?: any | null;
186
/** Base URL for crypto assets metadata service */
187
cryptoassetsBaseURL?: string | null;
188
/** Base URL for Clear Application Language service */
189
calServiceURL?: string | null;
190
}
191
```