UNPKG

33.2 kBMarkdownView Raw
1<img src="https://user-images.githubusercontent.com/4631227/191834116-59cf590e-25cc-4956-ae5c-812ea464f324.png" height="100" />
2
3[GitHub](https://github.com/LedgerHQ/ledger-live/),
4[Ledger Devs Discord](https://developers.ledger.com/discord-pro),
5[Developer Portal](https://developers.ledger.com/)
6
7## @ledgerhq/hw-app-eth
8
9Ledger Hardware Wallet ETH JavaScript bindings.
10
11***
12
13## Are you adding Ledger support to your software wallet?
14
15You may be using this package to communicate with the Ethereum Nano App.
16
17For a smooth and quick integration:
18
19* See the developers’ documentation on the [Developer Portal](https://developers.ledger.com/docs/transport/overview/) and
20* Go on [Discord](https://developers.ledger.com/discord-pro/) to chat with developer support and the developer community.
21
22***
23
24## API
25
26<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
27
28#### Table of Contents
29
30* [Eth](#eth)
31 * [Parameters](#parameters)
32 * [Examples](#examples)
33 * [getAddress](#getaddress)
34 * [Parameters](#parameters-1)
35 * [Examples](#examples-1)
36 * [signTransaction](#signtransaction)
37 * [Parameters](#parameters-2)
38 * [Examples](#examples-2)
39 * [clearSignTransaction](#clearsigntransaction)
40 * [Parameters](#parameters-3)
41 * [Examples](#examples-3)
42 * [getAppConfiguration](#getappconfiguration)
43 * [signPersonalMessage](#signpersonalmessage)
44 * [Parameters](#parameters-4)
45 * [Examples](#examples-4)
46 * [signEIP712HashedMessage](#signeip712hashedmessage)
47 * [Parameters](#parameters-5)
48 * [Examples](#examples-5)
49 * [signEIP712Message](#signeip712message)
50 * [Parameters](#parameters-6)
51 * [Examples](#examples-6)
52 * [getChallenge](#getchallenge)
53 * [starkGetPublicKey](#starkgetpublickey)
54 * [Parameters](#parameters-7)
55 * [starkSignOrder](#starksignorder)
56 * [Parameters](#parameters-8)
57 * [starkSignOrder\_v2](#starksignorder_v2)
58 * [Parameters](#parameters-9)
59 * [starkSignTransfer](#starksigntransfer)
60 * [Parameters](#parameters-10)
61 * [starkSignTransfer\_v2](#starksigntransfer_v2)
62 * [Parameters](#parameters-11)
63 * [starkProvideQuantum](#starkprovidequantum)
64 * [Parameters](#parameters-12)
65 * [starkProvideQuantum\_v2](#starkprovidequantum_v2)
66 * [Parameters](#parameters-13)
67 * [starkUnsafeSign](#starkunsafesign)
68 * [Parameters](#parameters-14)
69 * [eth2GetPublicKey](#eth2getpublickey)
70 * [Parameters](#parameters-15)
71 * [Examples](#examples-7)
72 * [eth2SetWithdrawalIndex](#eth2setwithdrawalindex)
73 * [Parameters](#parameters-16)
74 * [getEIP1024PublicEncryptionKey](#geteip1024publicencryptionkey)
75 * [Parameters](#parameters-17)
76 * [Examples](#examples-8)
77 * [getEIP1024SharedSecret](#geteip1024sharedsecret)
78 * [Parameters](#parameters-18)
79 * [Examples](#examples-9)
80 * [provideERC20TokenInformation](#provideerc20tokeninformation)
81 * [Parameters](#parameters-19)
82 * [setExternalPlugin](#setexternalplugin)
83 * [Parameters](#parameters-20)
84 * [setPlugin](#setplugin)
85 * [Parameters](#parameters-21)
86 * [provideNFTInformation](#providenftinformation)
87 * [Parameters](#parameters-22)
88 * [provideDomainName](#providedomainname)
89 * [Parameters](#parameters-23)
90* [loadInfosForContractMethod](#loadinfosforcontractmethod)
91 * [Parameters](#parameters-24)
92* [byContractAddressAndChainId](#bycontractaddressandchainid)
93 * [Parameters](#parameters-25)
94* [ResolutionConfig](#resolutionconfig)
95 * [Properties](#properties)
96
97### Eth
98
99Ethereum API
100
101#### Parameters
102
103* `transport` **Transport**&#x20;
104* `scrambleKey` (optional, default `"w0w"`)
105* `loadConfig` **LoadConfig** (optional, default `{}`)
106
107#### Examples
108
109```javascript
110import Eth from "@ledgerhq/hw-app-eth";
111const eth = new Eth(transport)
112```
113
114#### getAddress
115
116get Ethereum address for a given BIP 32 path.
117
118##### Parameters
119
120* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a path in BIP 32 format
121* `boolDisplay` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**&#x20;
122* `boolChaincode` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**&#x20;
123* `chainId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**&#x20;
124
125##### Examples
126
127```javascript
128eth.getAddress("44'/60'/0'/0/0").then(o => o.address)
129```
130
131Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{publicKey: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), address: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), chainCode: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?}>** an object with a publicKey, address and (optionally) chainCode
132
133#### signTransaction
134
135You can sign a transaction and retrieve v, r, s given the raw transaction and the BIP 32 path of the account to sign.
136
137##### Parameters
138
139* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** : the BIP32 path to sign the transaction on
140* `rawTxHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** : the raw ethereum transaction in hexadecimal to sign
141* `resolution` **(LedgerEthTransactionResolution | null)?** : resolution is an object with all "resolved" metadata necessary to allow the device to clear sign information. This includes: ERC20 token information, plugins, contracts, NFT signatures,... You must explicitly provide something to avoid having a warning. By default, you can use Ledger's service or your own resolution service. See services/types.js for the contract. Setting the value to "null" will fallback everything to blind signing but will still allow the device to sign the transaction.
142
143##### Examples
144
145```javascript
146import { ledgerService } from "@ledgerhq/hw-app-eth"
147const tx = "e8018504e3b292008252089428ee52a8f3d6e5d15f8b131996950d7f296c7952872bd72a2487400080"; // raw tx to sign
148const resolution = await ledgerService.resolveTransaction(tx);
149const result = eth.signTransaction("44'/60'/0'/0/0", tx, resolution);
150console.log(result);
151```
152
153Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), v: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**&#x20;
154
155#### clearSignTransaction
156
157Helper to get resolution and signature of a transaction in a single method
158
159##### Parameters
160
161* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** : the BIP32 path to sign the transaction on
162* `rawTxHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** : the raw ethereum transaction in hexadecimal to sign
163* `resolutionConfig` **[ResolutionConfig](#resolutionconfig)** : configuration about what should be clear signed in the transaction
164* `throwOnError` : optional parameter to determine if a failing resolution of the transaction should throw an error or not (optional, default `false`)
165
166##### Examples
167
168```javascript
169const tx = "e8018504e3b292008252089428ee52a8f3d6e5d15f8b131996950d7f296c7952872bd72a2487400080"; // raw tx to sign
170const result = eth.clearSignTransaction("44'/60'/0'/0/0", tx, { erc20: true, externalPlugins: true, nft: true});
171console.log(result);
172```
173
174Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), v: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**&#x20;
175
176#### getAppConfiguration
177
178Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{arbitraryDataEnabled: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), erc20ProvisioningNecessary: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), starkEnabled: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), starkv2Supported: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), version: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**&#x20;
179
180#### signPersonalMessage
181
182You can sign a message according to eth\_sign RPC call and retrieve v, r, s given the message and the BIP 32 path of the account to sign.
183
184##### Parameters
185
186* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
187* `messageHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
188
189##### Examples
190
191```javascript
192eth.signPersonalMessage("44'/60'/0'/0/0", Buffer.from("test").toString("hex")).then(result => {
193var v = result['v'] - 27;
194v = v.toString(16);
195if (v.length < 2) {
196v = "0" + v;
197}
198console.log("Signature 0x" + result['r'] + result['s'] + v);
199})
200```
201
202Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{v: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**&#x20;
203
204#### signEIP712HashedMessage
205
206Sign a prepared message following web3.eth.signTypedData specification. The host computes the domain separator and hashStruct(message)
207
208##### Parameters
209
210* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
211* `domainSeparatorHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
212* `hashStructMessageHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
213
214##### Examples
215
216```javascript
217eth.signEIP712HashedMessage("44'/60'/0'/0/0", Buffer.from("0101010101010101010101010101010101010101010101010101010101010101").toString("hex"), Buffer.from("0202020202020202020202020202020202020202020202020202020202020202").toString("hex")).then(result => {
218var v = result['v'] - 27;
219v = v.toString(16);
220if (v.length < 2) {
221v = "0" + v;
222}
223console.log("Signature 0x" + result['r'] + result['s'] + v);
224})
225```
226
227Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{v: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**&#x20;
228
229#### signEIP712Message
230
231Sign an EIP-721 formatted message following the specification here:
232<https://github.com/LedgerHQ/app-ethereum/blob/develop/doc/ethapp.asc#sign-eth-eip-712>
233⚠️ This method is not compatible with nano S (LNS). Make sure to use a try/catch to fallback on the signEIP712HashedMessage method ⚠️
234
235##### Parameters
236
237* `path` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** derivationPath
238* `jsonMessage` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** message to sign
239* `fullImplem` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** use the legacy implementation (optional, default `false`)
240
241##### Examples
242
243```javascript
244eth.signEIP721Message("44'/60'/0'/0/0", {
245domain: {
246chainId: 69,
247name: "Da Domain",
248verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
249version: "1"
250},
251types: {
252"EIP712Domain": [
253{ name: "name", type: "string" },
254{ name: "version", type: "string" },
255{ name: "chainId", type: "uint256" },
256{ name: "verifyingContract", type: "address" }
257],
258"Test": [
259{ name: "contents", type: "string" }
260]
261},
262primaryType: "Test",
263message: {contents: "Hello, Bob!"},
264})
265```
266
267Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)**&#x20;
268
269#### getChallenge
270
271Method returning a 4 bytes TLV challenge as an hexa string
272
273Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**&#x20;
274
275#### starkGetPublicKey
276
277get Stark public key for a given BIP 32 path.
278
279##### Parameters
280
281* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a path in BIP 32 format
282* `boolDisplay` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**&#x20;
283
284Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Buffer](https://nodejs.org/api/buffer.html)>** the Stark public key
285
286#### starkSignOrder
287
288sign a Stark order
289
290##### Parameters
291
292* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a path in BIP 32 format
293* `sourceTokenAddress` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;
294* `sourceQuantization` **BigNumber** quantization used for the source token
295* `destinationTokenAddress` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;
296* `destinationQuantization` **BigNumber** quantization used for the destination token
297* `sourceVault` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** ID of the source vault
298* `destinationVault` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** ID of the destination vault
299* `amountSell` **BigNumber** amount to sell
300* `amountBuy` **BigNumber** amount to buy
301* `nonce` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** transaction nonce
302* `timestamp` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** transaction validity timestamp
303
304Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<([Buffer](https://nodejs.org/api/buffer.html) | {r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)})>** the signature
305
306#### starkSignOrder\_v2
307
308sign a Stark order using the Starkex V2 protocol
309
310##### Parameters
311
312* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a path in BIP 32 format
313* `sourceTokenAddress` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;
314* `sourceQuantizationType` **StarkQuantizationType** quantization type used for the source token
315* `sourceQuantization` **(BigNumber | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;
316* `sourceMintableBlobOrTokenId` **(BigNumber | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;
317* `destinationTokenAddress` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;
318* `destinationQuantizationType` **StarkQuantizationType** quantization type used for the destination token
319* `destinationQuantization` **(BigNumber | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;
320* `destinationMintableBlobOrTokenId` **(BigNumber | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;
321* `sourceVault` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** ID of the source vault
322* `destinationVault` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** ID of the destination vault
323* `amountSell` **BigNumber** amount to sell
324* `amountBuy` **BigNumber** amount to buy
325* `nonce` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** transaction nonce
326* `timestamp` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** transaction validity timestamp
327
328Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<([Buffer](https://nodejs.org/api/buffer.html) | {r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)})>** the signature
329
330#### starkSignTransfer
331
332sign a Stark transfer
333
334##### Parameters
335
336* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a path in BIP 32 format
337* `transferTokenAddress` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;
338* `transferQuantization` **BigNumber** quantization used for the token to be transferred
339* `targetPublicKey` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** target Stark public key
340* `sourceVault` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** ID of the source vault
341* `destinationVault` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** ID of the destination vault
342* `amountTransfer` **BigNumber** amount to transfer
343* `nonce` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** transaction nonce
344* `timestamp` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** transaction validity timestamp
345
346Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<([Buffer](https://nodejs.org/api/buffer.html) | {r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)})>** the signature
347
348#### starkSignTransfer\_v2
349
350sign a Stark transfer or conditional transfer using the Starkex V2 protocol
351
352##### Parameters
353
354* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a path in BIP 32 format
355* `transferTokenAddress` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;
356* `transferQuantizationType` **StarkQuantizationType** quantization type used for the token to be transferred
357* `transferQuantization` **(BigNumber | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;
358* `transferMintableBlobOrTokenId` **(BigNumber | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;
359* `targetPublicKey` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** target Stark public key
360* `sourceVault` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** ID of the source vault
361* `destinationVault` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** ID of the destination vault
362* `amountTransfer` **BigNumber** amount to transfer
363* `nonce` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** transaction nonce
364* `timestamp` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** transaction validity timestamp
365* `conditionalTransferAddress` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**&#x20;
366* `conditionalTransferFact` **BigNumber?**&#x20;
367
368Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<([Buffer](https://nodejs.org/api/buffer.html) | {r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)})>** the signature
369
370#### starkProvideQuantum
371
372provide quantization information before singing a deposit or withdrawal Stark powered contract call
373
374It shall be run following a provideERC20TokenInformation call for the given contract
375
376##### Parameters
377
378* `operationContract` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** contract address of the token to be transferred (not present for ETH)
379* `operationQuantization` **BigNumber** quantization used for the token to be transferred
380
381Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>**&#x20;
382
383#### starkProvideQuantum\_v2
384
385provide quantization information before singing a deposit or withdrawal Stark powered contract call using the Starkex V2 protocol
386
387It shall be run following a provideERC20TokenInformation call for the given contract
388
389##### Parameters
390
391* `operationContract` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** contract address of the token to be transferred (not present for ETH)
392* `operationQuantizationType` **StarkQuantizationType** quantization type of the token to be transferred
393* `operationQuantization` **BigNumber?**&#x20;
394* `operationMintableBlobOrTokenId` **BigNumber?**&#x20;
395
396Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>**&#x20;
397
398#### starkUnsafeSign
399
400sign the given hash over the Stark curve
401It is intended for speed of execution in case an unknown Stark model is pushed and should be avoided as much as possible.
402
403##### Parameters
404
405* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a path in BIP 32 format
406* `hash` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** hexadecimal hash to sign
407
408Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<([Buffer](https://nodejs.org/api/buffer.html) | {r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)})>** the signature
409
410#### eth2GetPublicKey
411
412get an Ethereum 2 BLS-12 381 public key for a given BIP 32 path.
413
414##### Parameters
415
416* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a path in BIP 32 format
417* `boolDisplay` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**&#x20;
418
419##### Examples
420
421```javascript
422eth.eth2GetPublicKey("12381/3600/0/0").then(o => o.publicKey)
423```
424
425Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{publicKey: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>** an object with a publicKey
426
427#### eth2SetWithdrawalIndex
428
429Set the index of a Withdrawal key used as withdrawal credentials in an ETH 2 deposit contract call signature
430
431It shall be run before the ETH 2 deposit transaction is signed. If not called, the index is set to 0
432
433##### Parameters
434
435* `withdrawalIndex` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** index path in the EIP 2334 path m/12381/3600/withdrawalIndex/0
436
437Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** True if the method was executed successfully
438
439#### getEIP1024PublicEncryptionKey
440
441get a public encryption key on Curve25519 according to EIP 1024
442
443##### Parameters
444
445* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a path in BIP 32 format
446* `boolDisplay` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**&#x20;
447
448##### Examples
449
450```javascript
451eth.getEIP1024PublicEncryptionKey("44'/60'/0'/0/0").then(o => o.publicKey)
452```
453
454Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{publicKey: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>** an object with a publicKey
455
456#### getEIP1024SharedSecret
457
458get a shared secret on Curve25519 according to EIP 1024
459
460##### Parameters
461
462* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a path in BIP 32 format
463* `remotePublicKeyHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** remote Curve25519 public key
464* `boolDisplay` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**&#x20;
465
466##### Examples
467
468```javascript
469eth.getEIP1024SharedSecret("44'/60'/0'/0/0", "87020e80af6e07a6e4697f091eacadb9e7e6629cb7e5a8a371689a3ed53b3d64").then(o => o.sharedSecret)
470```
471
472Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{sharedSecret: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>** an object with a shared secret
473
474#### provideERC20TokenInformation
475
476provides a trusted description of an ERC 20 token to associate a contract address with a ticker and number of decimals.
477
478##### Parameters
479
480* `data` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** stringified buffer of ERC20 signature
481
482Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** a boolean
483
484#### setExternalPlugin
485
486provides the name of a trusted binding of a plugin with a contract address and a supported method selector. This plugin will be called to interpret contract data in the following transaction signing command.
487
488##### Parameters
489
490* `payload` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** external plugin data
491* `signature` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**&#x20;
492
493Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** a boolean
494
495#### setPlugin
496
497provides the name of a trusted binding of a plugin with a contract address and a supported method selector. This plugin will be called to interpret contract data in the following transaction signing command.
498
499##### Parameters
500
501* `data` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** stringified buffer of plugin signature
502
503Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** a boolean
504
505#### provideNFTInformation
506
507provides a trusted description of an NFT to associate a contract address with a collectionName.
508
509##### Parameters
510
511* `data` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** stringified buffer of the NFT description
512
513Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** a boolean
514
515#### provideDomainName
516
517provides a domain name (like ENS) to be displayed during transactions in place of the address it is associated to. It shall be run just before a transaction involving the associated address that would be displayed on the device.
518
519##### Parameters
520
521* `data` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** an stringied buffer of some TLV encoded data to represent the domain
522
523Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** a boolean
524
525### loadInfosForContractMethod
526
527Retrieve the metadatas a given contract address and a method selector
528
529#### Parameters
530
531* `contractAddress` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
532* `selector` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
533* `chainId` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**&#x20;
534* `userLoadConfig` **LoadConfig**&#x20;
535
536Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<(ContractMethod | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))>**&#x20;
537
538### byContractAddressAndChainId
539
540Retrieve the token information by a given contract address if any
541
542#### Parameters
543
544* `contract` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
545* `chainId` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**&#x20;
546* `erc20SignaturesBlob` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | null)?**&#x20;
547
548Returns **ReturnType\<any>**&#x20;
549
550### ResolutionConfig
551
552Allows to configure precisely what the service need to resolve.
553for instance you can set nft:true if you need clear signing on NFTs. If you set it and it is not a NFT transaction, it should still work but will do a useless service resolution.
554
555Type: {nft: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?, externalPlugins: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?, erc20: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?, domains: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<DomainDescriptor>?}
556
557#### Properties
558
559* `nft` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**&#x20;
560* `externalPlugins` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**&#x20;
561* `erc20` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**&#x20;
562* `domains` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<DomainDescriptor>?**&#x20;