@ledgerhq/hw-app-eth 6.21.2 → 6.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -100
- package/erc20.js +1 -1
- package/lib/Eth.d.ts +14 -33
- package/lib/Eth.d.ts.map +1 -1
- package/lib/Eth.js +280 -305
- package/lib/Eth.js.map +1 -1
- package/lib/services/ledger/contracts.d.ts +14 -0
- package/lib/services/ledger/contracts.d.ts.map +1 -0
- package/lib/{contracts.js → services/ledger/contracts.js} +0 -0
- package/lib/services/ledger/contracts.js.map +1 -0
- package/lib/services/ledger/erc20.d.ts +22 -0
- package/lib/services/ledger/erc20.d.ts.map +1 -0
- package/lib/{erc20.js → services/ledger/erc20.js} +0 -0
- package/lib/services/ledger/erc20.js.map +1 -0
- package/lib/services/ledger/index.d.ts +4 -0
- package/lib/services/ledger/index.d.ts.map +1 -0
- package/lib/services/ledger/index.js +191 -0
- package/lib/services/ledger/index.js.map +1 -0
- package/lib/services/ledger/loadConfig.d.ts +3 -0
- package/lib/services/ledger/loadConfig.d.ts.map +1 -0
- package/lib/{loadConfig.js → services/ledger/loadConfig.js} +0 -0
- package/lib/services/ledger/loadConfig.js.map +1 -0
- package/lib/services/ledger/nfts.d.ts +10 -0
- package/lib/services/ledger/nfts.d.ts.map +1 -0
- package/lib/{nfts.js → services/ledger/nfts.js} +10 -10
- package/lib/services/ledger/nfts.js.map +1 -0
- package/lib/services/types.d.ts +27 -0
- package/lib/services/types.d.ts.map +1 -0
- package/lib/services/types.js +3 -0
- package/lib/services/types.js.map +1 -0
- package/lib/utils.d.ts +8 -27
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +68 -68
- package/lib/utils.js.map +1 -1
- package/lib-es/Eth.d.ts +14 -33
- package/lib-es/Eth.d.ts.map +1 -1
- package/lib-es/Eth.js +268 -296
- package/lib-es/Eth.js.map +1 -1
- package/{lib → lib-es/services/ledger}/contracts.d.ts +1 -1
- package/lib-es/services/ledger/contracts.d.ts.map +1 -0
- package/lib-es/services/ledger/contracts.js +96 -0
- package/lib-es/services/ledger/contracts.js.map +1 -0
- package/{lib → lib-es/services/ledger}/erc20.d.ts +0 -0
- package/lib-es/services/ledger/erc20.d.ts.map +1 -0
- package/lib-es/services/ledger/erc20.js +64 -0
- package/lib-es/services/ledger/erc20.js.map +1 -0
- package/lib-es/services/ledger/index.d.ts +4 -0
- package/lib-es/services/ledger/index.d.ts.map +1 -0
- package/lib-es/services/ledger/index.js +189 -0
- package/lib-es/services/ledger/index.js.map +1 -0
- package/lib-es/services/ledger/loadConfig.d.ts +3 -0
- package/lib-es/services/ledger/loadConfig.d.ts.map +1 -0
- package/lib-es/services/ledger/loadConfig.js +20 -0
- package/lib-es/services/ledger/loadConfig.js.map +1 -0
- package/{lib → lib-es/services/ledger}/nfts.d.ts +2 -3
- package/lib-es/services/ledger/nfts.d.ts.map +1 -0
- package/lib-es/services/ledger/nfts.js +94 -0
- package/lib-es/services/ledger/nfts.js.map +1 -0
- package/lib-es/services/types.d.ts +27 -0
- package/lib-es/services/types.d.ts.map +1 -0
- package/lib-es/services/types.js +2 -0
- package/lib-es/services/types.js.map +1 -0
- package/lib-es/utils.d.ts +8 -27
- package/lib-es/utils.d.ts.map +1 -1
- package/lib-es/utils.js +66 -61
- package/lib-es/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/Eth.ts +133 -258
- package/src/{contracts.ts → services/ledger/contracts.ts} +1 -1
- package/src/{erc20.ts → services/ledger/erc20.ts} +0 -0
- package/src/services/ledger/index.ts +125 -0
- package/src/services/ledger/loadConfig.ts +14 -0
- package/src/{nfts.ts → services/ledger/nfts.ts} +11 -12
- package/src/services/types.ts +42 -0
- package/src/utils.ts +72 -94
- package/tests/Eth.test.ts +2 -2
- package/lib/contracts.d.ts.map +0 -1
- package/lib/contracts.js.map +0 -1
- package/lib/erc20.d.ts.map +0 -1
- package/lib/erc20.js.map +0 -1
- package/lib/loadConfig.d.ts +0 -7
- package/lib/loadConfig.d.ts.map +0 -1
- package/lib/loadConfig.js.map +0 -1
- package/lib/nfts.d.ts.map +0 -1
- package/lib/nfts.js.map +0 -1
- package/src/loadConfig.ts +0 -23
package/README.md
CHANGED
|
@@ -13,85 +13,50 @@ Ledger Hardware Wallet ETH JavaScript bindings.
|
|
|
13
13
|
|
|
14
14
|
#### Table of Contents
|
|
15
15
|
|
|
16
|
-
* [loadInfosForContractMethod](#loadinfosforcontractmethod)
|
|
17
|
-
* [Parameters](#parameters)
|
|
18
|
-
* [byContractAddressAndChainId](#bycontractaddressandchainid)
|
|
19
|
-
* [Parameters](#parameters-1)
|
|
20
|
-
* [list](#list)
|
|
21
16
|
* [Eth](#eth)
|
|
22
|
-
* [Parameters](#parameters
|
|
17
|
+
* [Parameters](#parameters)
|
|
23
18
|
* [Examples](#examples)
|
|
24
19
|
* [getAddress](#getaddress)
|
|
25
|
-
* [Parameters](#parameters-
|
|
20
|
+
* [Parameters](#parameters-1)
|
|
26
21
|
* [Examples](#examples-1)
|
|
27
|
-
* [provideERC20TokenInformation](#provideerc20tokeninformation)
|
|
28
|
-
* [Parameters](#parameters-4)
|
|
29
|
-
* [Examples](#examples-2)
|
|
30
22
|
* [signTransaction](#signtransaction)
|
|
31
|
-
* [Parameters](#parameters-
|
|
32
|
-
* [Examples](#examples-
|
|
23
|
+
* [Parameters](#parameters-2)
|
|
24
|
+
* [Examples](#examples-2)
|
|
33
25
|
* [getAppConfiguration](#getappconfiguration)
|
|
34
26
|
* [signPersonalMessage](#signpersonalmessage)
|
|
35
|
-
* [Parameters](#parameters-
|
|
36
|
-
* [Examples](#examples-
|
|
27
|
+
* [Parameters](#parameters-3)
|
|
28
|
+
* [Examples](#examples-3)
|
|
37
29
|
* [signEIP712HashedMessage](#signeip712hashedmessage)
|
|
38
|
-
* [Parameters](#parameters-
|
|
39
|
-
* [Examples](#examples-
|
|
30
|
+
* [Parameters](#parameters-4)
|
|
31
|
+
* [Examples](#examples-4)
|
|
40
32
|
* [starkGetPublicKey](#starkgetpublickey)
|
|
41
|
-
* [Parameters](#parameters-
|
|
33
|
+
* [Parameters](#parameters-5)
|
|
42
34
|
* [starkSignOrder](#starksignorder)
|
|
43
|
-
* [Parameters](#parameters-
|
|
35
|
+
* [Parameters](#parameters-6)
|
|
44
36
|
* [starkSignOrder_v2](#starksignorder_v2)
|
|
45
|
-
* [Parameters](#parameters-
|
|
37
|
+
* [Parameters](#parameters-7)
|
|
46
38
|
* [starkSignTransfer](#starksigntransfer)
|
|
47
|
-
* [Parameters](#parameters-
|
|
39
|
+
* [Parameters](#parameters-8)
|
|
48
40
|
* [starkSignTransfer_v2](#starksigntransfer_v2)
|
|
49
|
-
* [Parameters](#parameters-
|
|
41
|
+
* [Parameters](#parameters-9)
|
|
50
42
|
* [starkProvideQuantum](#starkprovidequantum)
|
|
51
|
-
* [Parameters](#parameters-
|
|
43
|
+
* [Parameters](#parameters-10)
|
|
52
44
|
* [starkProvideQuantum_v2](#starkprovidequantum_v2)
|
|
53
|
-
* [Parameters](#parameters-
|
|
45
|
+
* [Parameters](#parameters-11)
|
|
54
46
|
* [starkUnsafeSign](#starkunsafesign)
|
|
55
|
-
* [Parameters](#parameters-
|
|
47
|
+
* [Parameters](#parameters-12)
|
|
56
48
|
* [eth2GetPublicKey](#eth2getpublickey)
|
|
57
|
-
* [Parameters](#parameters-
|
|
58
|
-
* [Examples](#examples-
|
|
49
|
+
* [Parameters](#parameters-13)
|
|
50
|
+
* [Examples](#examples-5)
|
|
59
51
|
* [eth2SetWithdrawalIndex](#eth2setwithdrawalindex)
|
|
60
|
-
* [Parameters](#parameters-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
Retrieve the metadatas a given contract address and a method selector
|
|
69
|
-
|
|
70
|
-
#### Parameters
|
|
71
|
-
|
|
72
|
-
* `contractAddress` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
73
|
-
* `selector` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
74
|
-
* `chainId` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**
|
|
75
|
-
* `userLoadConfig` **LoadConfig**
|
|
76
|
-
|
|
77
|
-
Returns **[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))>**
|
|
78
|
-
|
|
79
|
-
### byContractAddressAndChainId
|
|
80
|
-
|
|
81
|
-
Retrieve the token information by a given contract address if any
|
|
82
|
-
|
|
83
|
-
#### Parameters
|
|
84
|
-
|
|
85
|
-
* `contract` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
86
|
-
* `chainId` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**
|
|
87
|
-
|
|
88
|
-
Returns **(TokenInfo | null | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**
|
|
89
|
-
|
|
90
|
-
### list
|
|
91
|
-
|
|
92
|
-
list all the ERC20 tokens informations
|
|
93
|
-
|
|
94
|
-
Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<TokenInfo>**
|
|
52
|
+
* [Parameters](#parameters-14)
|
|
53
|
+
* [loadInfosForContractMethod](#loadinfosforcontractmethod)
|
|
54
|
+
* [Parameters](#parameters-15)
|
|
55
|
+
* [byContractAddressAndChainId](#bycontractaddressandchainid)
|
|
56
|
+
* [Parameters](#parameters-16)
|
|
57
|
+
* [list](#list)
|
|
58
|
+
* [ResolutionConfig](#resolutionconfig)
|
|
59
|
+
* [Properties](#properties)
|
|
95
60
|
|
|
96
61
|
### Eth
|
|
97
62
|
|
|
@@ -128,44 +93,24 @@ eth.getAddress("44'/60'/0'/0/0").then(o => o.address)
|
|
|
128
93
|
|
|
129
94
|
Returns **[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
|
|
130
95
|
|
|
131
|
-
#### provideERC20TokenInformation
|
|
132
|
-
|
|
133
|
-
This commands provides a trusted description of an ERC 20 token
|
|
134
|
-
to associate a contract address with a ticker and number of decimals.
|
|
135
|
-
|
|
136
|
-
It shall be run immediately before performing a transaction involving a contract
|
|
137
|
-
calling this contract address to display the proper token information to the user if necessary.
|
|
138
|
-
|
|
139
|
-
##### Parameters
|
|
140
|
-
|
|
141
|
-
* `info` **any** : a blob from "erc20.js" utilities that contains all token information.
|
|
142
|
-
|
|
143
|
-
* `info.data`
|
|
144
|
-
|
|
145
|
-
##### Examples
|
|
146
|
-
|
|
147
|
-
```javascript
|
|
148
|
-
import { byContractAddressAndChainId } from "@ledgerhq/hw-app-eth/erc20"
|
|
149
|
-
const zrxInfo = byContractAddressAndChainId("0xe41d2489571d322189246dafa5ebde1f4699f498", chainId)
|
|
150
|
-
if (zrxInfo) await appEth.provideERC20TokenInformation(zrxInfo)
|
|
151
|
-
const signed = await appEth.signTransaction(path, rawTxHex)
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>**
|
|
155
|
-
|
|
156
96
|
#### signTransaction
|
|
157
97
|
|
|
158
|
-
You can sign a transaction and retrieve v, r, s given the raw transaction and the BIP 32 path of the account to sign
|
|
98
|
+
You can sign a transaction and retrieve v, r, s given the raw transaction and the BIP 32 path of the account to sign.
|
|
159
99
|
|
|
160
100
|
##### Parameters
|
|
161
101
|
|
|
162
|
-
* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
163
|
-
* `rawTxHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
102
|
+
* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** : the BIP32 path to sign the transaction on
|
|
103
|
+
* `rawTxHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** : the raw ethereum transaction in hexadecimal to sign
|
|
104
|
+
* `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.
|
|
164
105
|
|
|
165
106
|
##### Examples
|
|
166
107
|
|
|
167
108
|
```javascript
|
|
168
|
-
|
|
109
|
+
import ledgerService from "@ledgerhq/hw-app-eth/lib/services/ledger"
|
|
110
|
+
const tx = "e8018504e3b292008252089428ee52a8f3d6e5d15f8b131996950d7f296c7952872bd72a2487400080"; // raw tx to sign
|
|
111
|
+
const resolution = await ledgerService.resolveTransaction(tx);
|
|
112
|
+
const result = eth.signTransaction("44'/60'/0'/0/0", tx, resolution);
|
|
113
|
+
console.log(result);
|
|
169
114
|
```
|
|
170
115
|
|
|
171
116
|
Returns **[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)}>**
|
|
@@ -387,24 +332,45 @@ It shall be run before the ETH 2 deposit transaction is signed. If not called, t
|
|
|
387
332
|
|
|
388
333
|
Returns **[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
|
|
389
334
|
|
|
390
|
-
|
|
335
|
+
### loadInfosForContractMethod
|
|
391
336
|
|
|
392
|
-
|
|
337
|
+
Retrieve the metadatas a given contract address and a method selector
|
|
393
338
|
|
|
394
|
-
|
|
339
|
+
#### Parameters
|
|
395
340
|
|
|
396
|
-
* `pluginName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** string containing the name of the plugin, must have length between 1 and 30 bytes
|
|
397
341
|
* `contractAddress` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
398
342
|
* `selector` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
343
|
+
* `chainId` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**
|
|
344
|
+
* `userLoadConfig` **LoadConfig**
|
|
399
345
|
|
|
400
|
-
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[
|
|
346
|
+
Returns **[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))>**
|
|
401
347
|
|
|
402
|
-
|
|
348
|
+
### byContractAddressAndChainId
|
|
403
349
|
|
|
404
|
-
|
|
350
|
+
Retrieve the token information by a given contract address if any
|
|
405
351
|
|
|
406
|
-
|
|
352
|
+
#### Parameters
|
|
353
|
+
|
|
354
|
+
* `contract` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
355
|
+
* `chainId` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**
|
|
407
356
|
|
|
408
|
-
|
|
357
|
+
Returns **(TokenInfo | null | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**
|
|
409
358
|
|
|
410
|
-
|
|
359
|
+
### list
|
|
360
|
+
|
|
361
|
+
list all the ERC20 tokens informations
|
|
362
|
+
|
|
363
|
+
Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<TokenInfo>**
|
|
364
|
+
|
|
365
|
+
### ResolutionConfig
|
|
366
|
+
|
|
367
|
+
Allows to configure precisely what the service need to resolve.
|
|
368
|
+
for 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.
|
|
369
|
+
|
|
370
|
+
Type: {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)?}
|
|
371
|
+
|
|
372
|
+
#### Properties
|
|
373
|
+
|
|
374
|
+
* `nft` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**
|
|
375
|
+
* `externalPlugins` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**
|
|
376
|
+
* `erc20` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**
|
package/erc20.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require("./lib/erc20");
|
|
1
|
+
module.exports = require("./lib/services/ledger/erc20");
|
package/lib/Eth.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type Transport from "@ledgerhq/hw-transport";
|
|
3
3
|
import { BigNumber } from "bignumber.js";
|
|
4
|
-
import
|
|
4
|
+
import { LedgerEthTransactionResolution, LoadConfig } from "./services/types";
|
|
5
5
|
export declare type StarkQuantizationType = "eth" | "erc20" | "erc721" | "erc20mintable" | "erc721mintable";
|
|
6
6
|
/**
|
|
7
7
|
* Ethereum API
|
|
@@ -30,29 +30,19 @@ export default class Eth {
|
|
|
30
30
|
chainCode?: string;
|
|
31
31
|
}>;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
* to associate a contract address with a ticker and number of decimals.
|
|
33
|
+
* You can sign a transaction and retrieve v, r, s given the raw transaction and the BIP 32 path of the account to sign.
|
|
35
34
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @param {*} info: a blob from "erc20.js" utilities that contains all token information.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* import { byContractAddressAndChainId } from "@ledgerhq/hw-app-eth/erc20"
|
|
43
|
-
* const zrxInfo = byContractAddressAndChainId("0xe41d2489571d322189246dafa5ebde1f4699f498", chainId)
|
|
44
|
-
* if (zrxInfo) await appEth.provideERC20TokenInformation(zrxInfo)
|
|
45
|
-
* const signed = await appEth.signTransaction(path, rawTxHex)
|
|
46
|
-
*/
|
|
47
|
-
provideERC20TokenInformation({ data }: {
|
|
48
|
-
data: Buffer;
|
|
49
|
-
}): Promise<boolean>;
|
|
50
|
-
/**
|
|
51
|
-
* You can sign a transaction and retrieve v, r, s given the raw transaction and the BIP 32 path of the account to sign
|
|
35
|
+
* @param path: the BIP32 path to sign the transaction on
|
|
36
|
+
* @param rawTxHex: the raw ethereum transaction in hexadecimal to sign
|
|
37
|
+
* @param resolution: 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.
|
|
52
38
|
* @example
|
|
53
|
-
|
|
39
|
+
import ledgerService from "@ledgerhq/hw-app-eth/lib/services/ledger"
|
|
40
|
+
const tx = "e8018504e3b292008252089428ee52a8f3d6e5d15f8b131996950d7f296c7952872bd72a2487400080"; // raw tx to sign
|
|
41
|
+
const resolution = await ledgerService.resolveTransaction(tx);
|
|
42
|
+
const result = eth.signTransaction("44'/60'/0'/0/0", tx, resolution);
|
|
43
|
+
console.log(result);
|
|
54
44
|
*/
|
|
55
|
-
signTransaction(path: string, rawTxHex: string): Promise<{
|
|
45
|
+
signTransaction(path: string, rawTxHex: string, resolution?: LedgerEthTransactionResolution | null): Promise<{
|
|
56
46
|
s: string;
|
|
57
47
|
v: string;
|
|
58
48
|
r: string;
|
|
@@ -238,19 +228,10 @@ export default class Eth {
|
|
|
238
228
|
* @return True if the method was executed successfully
|
|
239
229
|
*/
|
|
240
230
|
eth2SetWithdrawalIndex(withdrawalIndex: number): Promise<boolean>;
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
* @param pluginName string containing the name of the plugin, must have length between 1 and 30 bytes
|
|
245
|
-
* @return True if the method was executed successfully
|
|
246
|
-
*/
|
|
231
|
+
provideERC20TokenInformation({ data }: {
|
|
232
|
+
data: Buffer;
|
|
233
|
+
}): Promise<boolean>;
|
|
247
234
|
setExternalPlugin(pluginName: string, contractAddress: string, selector: string): Promise<boolean>;
|
|
248
|
-
/**
|
|
249
|
-
* Set the plugin (internal or external) that should be used to parse the next transaction
|
|
250
|
-
*
|
|
251
|
-
* @param data string containing the payload and signature that will be parsed and verified by the device.
|
|
252
|
-
* @return True if the method was executed successfully
|
|
253
|
-
*/
|
|
254
235
|
setPlugin(data: string): Promise<boolean>;
|
|
255
236
|
}
|
|
256
237
|
//# sourceMappingURL=Eth.d.ts.map
|
package/lib/Eth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Eth.d.ts","sourceRoot":"","sources":["../src/Eth.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Eth.d.ts","sourceRoot":"","sources":["../src/Eth.ts"],"names":[],"mappings":";AAkB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