Skip to content

Commit 941c8a2

Browse files
author
Fabrice Bascoulergue
authored
Merge pull request #6 from lum-network/develop
Implement ledger transaction signature
2 parents 0394292 + c904f57 commit 941c8a2

30 files changed

+1154
-125
lines changed

docs/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ console.log(`Wallet address: ${wallet.address}`);
6060
### Hardware wallets
6161

6262
**IMPORTANT NOTES:**
63-
- Transaction signature using Hardware devices is currently work in progress, therefore broadcasting a transaction is not possible at the moment.
64-
- Derivation path using the Cosmos Ledger application cannot be set to the default Lum Path for now `m/44'/118'/0'/*/*` and must remain on the Cosmos path `m/44'/'837/0'/*/*`
63+
- Transaction signature using Ledger only works with legacy amino (wich will be deprecated at some point)
64+
- Derivation path using the Cosmos Ledger application cannot be set to the default Lum Path for now `m/44'/837'/0'/*/*` and must remain on the Cosmos path `m/44'/'118/0'/*/*`
6565

6666
#### Ledger
6767

docs/lib/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,24 @@
1212
### Classes
1313

1414
- [LumClient](classes/lumclient.md)
15+
- [LumLedgerWallet](classes/lumledgerwallet.md)
16+
- [LumPaperWallet](classes/lumpaperwallet.md)
1517
- [LumWallet](classes/lumwallet.md)
18+
- [LumWalletFactory](classes/lumwalletfactory.md)
1619

1720
### Variables
1821

22+
- [LumAminoRegistry](README.md#lumaminoregistry)
1923
- [LumRegistry](README.md#lumregistry)
2024

2125
## Variables
2226

27+
### LumAminoRegistry
28+
29+
`Const` **LumAminoRegistry**: *AminoTypes*
30+
31+
___
32+
2333
### LumRegistry
2434

2535
`Const` **LumRegistry**: *ExtendedRegistry*

docs/lib/classes/lumclient.md

+8-30
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
- [getChainId](lumclient.md#getchainid)
2828
- [getSupply](lumclient.md#getsupply)
2929
- [getTx](lumclient.md#gettx)
30-
- [getValidators](lumclient.md#getvalidators)
3130
- [searchTx](lumclient.md#searchtx)
3231
- [signAndBroadcastTx](lumclient.md#signandbroadcasttx)
3332
- [signTx](lumclient.md#signtx)
@@ -39,15 +38,15 @@
3938

4039
### constructor
4140

42-
\+ **new LumClient**(`tmClient`: *Client*): [*LumClient*](lumclient.md)
41+
\+ **new LumClient**(`tmClient`: *Tendermint34Client*): [*LumClient*](lumclient.md)
4342

4443
Create a LumClient instance using a tendermint RPC client
4544

4645
#### Parameters:
4746

4847
Name | Type | Description |
4948
:------ | :------ | :------ |
50-
`tmClient` | *Client* | tendermint RPC client |
49+
`tmClient` | *Tendermint34Client* | tendermint RPC client |
5150

5251
**Returns:** [*LumClient*](lumclient.md)
5352

@@ -67,7 +66,7 @@ ___
6766

6867
### tmClient
6968

70-
`Readonly` **tmClient**: *Client*
69+
`Readonly` **tmClient**: *Tendermint34Client*
7170

7271
## Methods
7372

@@ -259,23 +258,6 @@ Name | Type | Description |
259258

260259
___
261260

262-
### getValidators
263-
264-
**getValidators**(`blockHeight?`: *number*): *Promise*<ValidatorsResponse\>
265-
266-
Get all validators
267-
Validators are sorted first by voting power (descending), then by address (ascending)
268-
269-
#### Parameters:
270-
271-
Name | Type | Description |
272-
:------ | :------ | :------ |
273-
`blockHeight?` | *number* | block height to return. If no height is provided, it will fetch validator set which corresponds to the latest block |
274-
275-
**Returns:** *Promise*<ValidatorsResponse\>
276-
277-
___
278-
279261
### searchTx
280262

281263
**searchTx**(`queries`: *string*[], `page?`: *number*, `perPage?`: *number*, `includeProof?`: *boolean*): *Promise*<TxResponse[]\>
@@ -294,7 +276,7 @@ Name | Type | Default value | Description |
294276
:------ | :------ | :------ | :------ |
295277
`queries` | *string*[] | - | queries to run (see utils/search for helpers) |
296278
`page` | *number* | 1 | page to query (default to 1) |
297-
`perPage` | *number* | 30 | result per pages (default to 30) |
279+
`perPage` | *number* | 30 | results per pages (default to 30) |
298280
`includeProof?` | *boolean* | - | whether or not to include proofs of the transactions inclusion in the block |
299281

300282
**Returns:** *Promise*<TxResponse[]\>
@@ -303,7 +285,7 @@ ___
303285

304286
### signAndBroadcastTx
305287

306-
**signAndBroadcastTx**(`wallet`: [*LumWallet*](lumwallet.md), `messages`: [*Message*](../interfaces/lummessages.message.md)[], `fee`: [*Fee*](../interfaces/lumtypes.fee.md), `memo?`: *string*): *Promise*<BroadcastTxCommitResponse\>
288+
**signAndBroadcastTx**(`wallet`: [*LumWallet*](lumwallet.md), `doc`: [*Doc*](../interfaces/lumtypes.doc.md)): *Promise*<BroadcastTxCommitResponse\>
307289

308290
Signs and broadcast the transaction using the specified wallet and messages
309291

@@ -312,17 +294,15 @@ Signs and broadcast the transaction using the specified wallet and messages
312294
Name | Type | Description |
313295
:------ | :------ | :------ |
314296
`wallet` | [*LumWallet*](lumwallet.md) | signing wallet |
315-
`messages` | [*Message*](../interfaces/lummessages.message.md)[] | messages to sign |
316-
`fee` | [*Fee*](../interfaces/lumtypes.fee.md) | requested fee |
317-
`memo?` | *string* | optional memo for the transaction |
297+
`doc` | [*Doc*](../interfaces/lumtypes.doc.md) | document to sign and broadcast as a transaction |
318298

319299
**Returns:** *Promise*<BroadcastTxCommitResponse\>
320300

321301
___
322302

323303
### signTx
324304

325-
**signTx**(`wallet`: [*LumWallet*](lumwallet.md), `messages`: [*Message*](../interfaces/lummessages.message.md)[], `fee`: [*Fee*](../interfaces/lumtypes.fee.md), `memo?`: *string*): *Promise*<Uint8Array\>
305+
**signTx**(`wallet`: [*LumWallet*](lumwallet.md), `doc`: [*Doc*](../interfaces/lumtypes.doc.md)): *Promise*<Uint8Array\>
326306

327307
Signs the messages using the provided wallet and builds the transaction
328308

@@ -331,9 +311,7 @@ Signs the messages using the provided wallet and builds the transaction
331311
Name | Type | Description |
332312
:------ | :------ | :------ |
333313
`wallet` | [*LumWallet*](lumwallet.md) | signing wallet |
334-
`messages` | [*Message*](../interfaces/lummessages.message.md)[] | messages to sign |
335-
`fee` | [*Fee*](../interfaces/lumtypes.fee.md) | requested fee |
336-
`memo?` | *string* | optional memo for the transaction |
314+
`doc` | [*Doc*](../interfaces/lumtypes.doc.md) | document to sign |
337315

338316
**Returns:** *Promise*<Uint8Array\>
339317

docs/lib/classes/lumledgerwallet.md

+169
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
# Class: LumLedgerWallet
2+
3+
## Hierarchy
4+
5+
* [*LumWallet*](lumwallet.md)
6+
7+
**LumLedgerWallet**
8+
9+
## Table of contents
10+
11+
### Constructors
12+
13+
- [constructor](lumledgerwallet.md#constructor)
14+
15+
### Properties
16+
17+
- [address](lumledgerwallet.md#address)
18+
- [cosmosApp](lumledgerwallet.md#cosmosapp)
19+
- [hdPath](lumledgerwallet.md#hdpath)
20+
- [publicKey](lumledgerwallet.md#publickey)
21+
22+
### Methods
23+
24+
- [canChangeAccount](lumledgerwallet.md#canchangeaccount)
25+
- [getAddress](lumledgerwallet.md#getaddress)
26+
- [getAppConfiguration](lumledgerwallet.md#getappconfiguration)
27+
- [getPublicKey](lumledgerwallet.md#getpublickey)
28+
- [signTransaction](lumledgerwallet.md#signtransaction)
29+
- [signingMode](lumledgerwallet.md#signingmode)
30+
- [useAccount](lumledgerwallet.md#useaccount)
31+
32+
## Constructors
33+
34+
### constructor
35+
36+
\+ **new LumLedgerWallet**(`transport`: *Transport*<string\>): [*LumLedgerWallet*](lumledgerwallet.md)
37+
38+
#### Parameters:
39+
40+
Name | Type |
41+
:------ | :------ |
42+
`transport` | *Transport*<string\> |
43+
44+
**Returns:** [*LumLedgerWallet*](lumledgerwallet.md)
45+
46+
Inherited from: [LumWallet](lumwallet.md)
47+
48+
## Properties
49+
50+
### address
51+
52+
`Protected` `Optional` **address**: *undefined* \| *string*
53+
54+
Inherited from: [LumWallet](lumwallet.md).[address](lumwallet.md#address)
55+
56+
___
57+
58+
### cosmosApp
59+
60+
**cosmosApp**: *default*
61+
62+
___
63+
64+
### hdPath
65+
66+
`Private` `Optional` **hdPath**: *undefined* \| *string*
67+
68+
___
69+
70+
### publicKey
71+
72+
`Protected` `Optional` **publicKey**: *undefined* \| *Uint8Array*
73+
74+
Inherited from: [LumWallet](lumwallet.md).[publicKey](lumwallet.md#publickey)
75+
76+
## Methods
77+
78+
### canChangeAccount
79+
80+
**canChangeAccount**(): *boolean*
81+
82+
**Returns:** *boolean*
83+
84+
Inherited from: [LumWallet](lumwallet.md)
85+
86+
___
87+
88+
### getAddress
89+
90+
**getAddress**(): *string*
91+
92+
Gets the current wallet address
93+
94+
**`see`** [LumWallet.useAccount](lumwallet.md#useaccount)
95+
96+
**Returns:** *string*
97+
98+
wallet address (Bech32)
99+
100+
Inherited from: [LumWallet](lumwallet.md)
101+
102+
___
103+
104+
### getAppConfiguration
105+
106+
**getAppConfiguration**(): *Promise*<{ `device_locked`: *boolean* ; `major`: *string* ; `test_mode`: *boolean* ; `version`: *string* }\>
107+
108+
Gets the connected application configuration
109+
110+
**Returns:** *Promise*<{ `device_locked`: *boolean* ; `major`: *string* ; `test_mode`: *boolean* ; `version`: *string* }\>
111+
112+
___
113+
114+
### getPublicKey
115+
116+
**getPublicKey**(): *Uint8Array*
117+
118+
Gets the current wallet public key
119+
120+
**`see`** [LumWallet.useAccount](lumwallet.md#useaccount)
121+
122+
**Returns:** *Uint8Array*
123+
124+
wallet public key (secp256k1)
125+
126+
Inherited from: [LumWallet](lumwallet.md)
127+
128+
___
129+
130+
### signTransaction
131+
132+
**signTransaction**(`doc`: [*Doc*](../interfaces/lumtypes.doc.md)): *Promise*<Uint8Array\>
133+
134+
#### Parameters:
135+
136+
Name | Type |
137+
:------ | :------ |
138+
`doc` | [*Doc*](../interfaces/lumtypes.doc.md) |
139+
140+
**Returns:** *Promise*<Uint8Array\>
141+
142+
Inherited from: [LumWallet](lumwallet.md)
143+
144+
___
145+
146+
### signingMode
147+
148+
**signingMode**(): SignMode
149+
150+
**Returns:** SignMode
151+
152+
Inherited from: [LumWallet](lumwallet.md)
153+
154+
___
155+
156+
### useAccount
157+
158+
**useAccount**(`hdPath`: *string*, `addressPrefix`: *string*): *Promise*<boolean\>
159+
160+
#### Parameters:
161+
162+
Name | Type |
163+
:------ | :------ |
164+
`hdPath` | *string* |
165+
`addressPrefix` | *string* |
166+
167+
**Returns:** *Promise*<boolean\>
168+
169+
Inherited from: [LumWallet](lumwallet.md)

0 commit comments

Comments
 (0)