Skip to content

Commit 080ef93

Browse files
committed
Upgrade dependencies and add types in Amino types
1 parent f592247 commit 080ef93

File tree

17 files changed

+255
-270
lines changed

17 files changed

+255
-270
lines changed

docs/lib/classes/lumledgerwallet.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ ___
193193

194194
### signTransaction
195195

196-
**signTransaction**(`doc`): `Promise`<[[`SignDoc`](../interfaces/LumTypes.SignDoc.md), `Uint8Array`]\>
196+
**signTransaction**(`doc`): `Promise`<[`SignDoc`, `Uint8Array`]\>
197197

198198
Sign a transaction document using a LumWallet
199199

@@ -205,7 +205,7 @@ Sign a transaction document using a LumWallet
205205

206206
#### Returns
207207

208-
`Promise`<[[`SignDoc`](../interfaces/LumTypes.SignDoc.md), `Uint8Array`]\>
208+
`Promise`<[`SignDoc`, `Uint8Array`]\>
209209

210210
#### Overrides
211211

docs/lib/classes/lumpaperwallet.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ ___
189189

190190
### signTransaction
191191

192-
**signTransaction**(`doc`): `Promise`<[[`SignDoc`](../interfaces/LumTypes.SignDoc.md), `Uint8Array`]\>
192+
**signTransaction**(`doc`): `Promise`<[`SignDoc`, `Uint8Array`]\>
193193

194194
Sign a transaction document using a LumWallet
195195

@@ -201,7 +201,7 @@ Sign a transaction document using a LumWallet
201201

202202
#### Returns
203203

204-
`Promise`<[[`SignDoc`](../interfaces/LumTypes.SignDoc.md), `Uint8Array`]\>
204+
`Promise`<[`SignDoc`, `Uint8Array`]\>
205205

206206
#### Overrides
207207

docs/lib/classes/lumwallet.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ ___
137137

138138
### signTransaction
139139

140-
`Abstract` **signTransaction**(`doc`): `Promise`<[[`SignDoc`](../interfaces/LumTypes.SignDoc.md), `Uint8Array`]\>
140+
`Abstract` **signTransaction**(`doc`): `Promise`<[`SignDoc`, `Uint8Array`]\>
141141

142142
Sign a transaction document using a LumWallet
143143

@@ -149,7 +149,7 @@ Sign a transaction document using a LumWallet
149149

150150
#### Returns
151151

152-
`Promise`<[[`SignDoc`](../interfaces/LumTypes.SignDoc.md), `Uint8Array`]\>
152+
`Promise`<[`SignDoc`, `Uint8Array`]\>
153153

154154
___
155155

docs/lib/interfaces/lumtypes.signdoc.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

docs/lib/modules/lumtypes.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,24 @@
1616
- [LogAttribute](../interfaces/LumTypes.LogAttribute.md)
1717
- [LogEvent](../interfaces/LumTypes.LogEvent.md)
1818
- [PubKey](../interfaces/LumTypes.PubKey.md)
19-
- [SignDoc](../interfaces/LumTypes.SignDoc.md)
2019
- [SignMsg](../interfaces/LumTypes.SignMsg.md)
2120
- [Tx](../interfaces/LumTypes.Tx.md)
2221

22+
### Type aliases
23+
24+
- [SignDoc](LumTypes.md#signdoc)
25+
2326
### Variables
2427

2528
- [PubKey](LumTypes.md#pubkey)
2629
- [Tx](LumTypes.md#tx)
2730

31+
## Type aliases
32+
33+
### SignDoc
34+
35+
Ƭ **SignDoc**: `SignDocCosmos`
36+
2837
## Variables
2938

3039
### PubKey

docs/lib/modules/lumutils.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ ___
230230

231231
### generateSignDoc
232232

233-
`Const` **generateSignDoc**(`doc`, `signerIdx`, `signMode`): [`SignDoc`](../interfaces/LumTypes.SignDoc.md)
233+
`Const` **generateSignDoc**(`doc`, `signerIdx`, `signMode`): `SignDoc`
234234

235235
Generate transaction doc to be signed
236236

@@ -244,7 +244,7 @@ Generate transaction doc to be signed
244244

245245
#### Returns
246246

247-
[`SignDoc`](../interfaces/LumTypes.SignDoc.md)
247+
`SignDoc`
248248

249249
___
250250

@@ -258,7 +258,7 @@ Generate transaction sign doc bytes used to sign the transaction
258258

259259
| Name | Type | Description |
260260
| :------ | :------ | :------ |
261-
| `signDoc` | [`SignDoc`](../interfaces/LumTypes.SignDoc.md) | sign doc (as generated by the generateSignDoc function) |
261+
| `signDoc` | `SignDoc` | sign doc (as generated by the generateSignDoc function) |
262262

263263
#### Returns
264264

@@ -295,7 +295,7 @@ Generate transaction bytes to broadcast
295295

296296
| Name | Type | Description |
297297
| :------ | :------ | :------ |
298-
| `signDoc` | [`SignDoc`](../interfaces/LumTypes.SignDoc.md) | sign doc (as generated by the generateSignDoc function) |
298+
| `signDoc` | `SignDoc` | sign doc (as generated by the generateSignDoc function) |
299299
| `signatures` | `Uint8Array`[] | transaction signatures (as generated by the generateSignature function) |
300300

301301
#### Returns

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,28 @@
3535
"format": "prettier --write '**/*.{js,jsx,ts,tsx,css,json,md,html,yml}'",
3636
"bump": "npm version",
3737
"preget-proto": "rm -rf proto",
38-
"get-proto": "COSMOS_REF=v0.46.7 IBC_REF=v5.0.1 LUM_REF=v1.3.0 sh ./scripts/get-proto.sh",
38+
"get-proto": "COSMOS_REF=v0.46.7 IBC_REF=v5.0.1 LUM_REF=v1.3.1 sh ./scripts/get-proto.sh",
3939
"define-proto": "sh ./scripts/define-proto.sh",
4040
"postdefine-proto": "prettier --write \"src/codec/**/*.ts\""
4141
},
4242
"dependencies": {
43-
"@cosmjs/amino": "0.26.5",
44-
"@cosmjs/crypto": "0.26.5",
45-
"@cosmjs/encoding": "0.26.5",
46-
"@cosmjs/math": "0.26.5",
47-
"@cosmjs/proto-signing": "0.26.5",
48-
"@cosmjs/stargate": "0.26.5",
49-
"@cosmjs/tendermint-rpc": "0.26.5",
50-
"@cosmjs/utils": "0.26.5",
51-
"@ledgerhq/hw-app-cosmos": "^6.11.2",
52-
"@ledgerhq/hw-transport": "^6.11.2",
53-
"@types/crypto-js": "^4.0.2",
43+
"@cosmjs/amino": "0.29.5",
44+
"@cosmjs/crypto": "0.29.5",
45+
"@cosmjs/encoding": "0.29.5",
46+
"@cosmjs/math": "0.29.5",
47+
"@cosmjs/proto-signing": "0.29.5",
48+
"@cosmjs/stargate": "0.29.5",
49+
"@cosmjs/tendermint-rpc": "0.29.5",
50+
"@cosmjs/utils": "0.29.5",
51+
"@ledgerhq/hw-app-cosmos": "^6.27.10",
52+
"@ledgerhq/hw-transport": "^6.27.10",
53+
"@types/crypto-js": "^4.1.1",
5454
"@types/ledgerhq__hw-transport": "^4.21.4",
55-
"@types/uuid": "^8.3.1",
55+
"@types/uuid": "^9.0.0",
5656
"crypto-browserify": "^3.12.0",
5757
"crypto-js": "^4.1.1",
58-
"long": "^4.0.0",
59-
"uuid": "^8.3.2"
58+
"long": "^5.2.1",
59+
"uuid": "^9.0.0"
6060
},
6161
"optionalDependencies": {},
6262
"devDependencies": {

src/client/LumClient.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
import { setupSlashingExtension, SlashingExtension } from '../extensions/slashing';
3030
import { AuthzExtension, setupAuthzExtension } from '../extensions/authz';
3131
import { FeegrantExtension, setupFeegrantExtension } from '../extensions/feegrant';
32+
import { createAminoTypes } from '../registry/aminoTypes';
3233

3334
export class LumClient {
3435
readonly tmClient: Tendermint34Client;
@@ -98,6 +99,8 @@ export class LumClient {
9899
*/
99100
static connect = async (endpoint: string): Promise<LumClient> => {
100101
const tmClient = await Tendermint34Client.connect(endpoint);
102+
console.log(createAminoTypes());
103+
101104
return new LumClient(tmClient);
102105
};
103106

@@ -127,8 +130,7 @@ export class LumClient {
127130
* Get the connected node status information
128131
*/
129132
status = async (): Promise<StatusResponse> => {
130-
const status = await this.tmClient.status();
131-
return status;
133+
return this.tmClient.status();
132134
};
133135

134136
/**
@@ -194,8 +196,7 @@ export class LumClient {
194196
* @param address wallet address
195197
*/
196198
getAllBalances = async (address: string): Promise<LumTypes.Coin[]> => {
197-
const balances = await this.queryClient.bank.allBalances(address);
198-
return balances;
199+
return this.queryClient.bank.allBalances(address);
199200
};
200201

201202
/**
@@ -212,8 +213,7 @@ export class LumClient {
212213
* Get all coins supplies
213214
*/
214215
getAllSupplies = async (): Promise<LumTypes.Coin[]> => {
215-
const supplies = await this.queryClient.bank.totalSupply();
216-
return supplies;
216+
return this.queryClient.bank.totalSupply();
217217
};
218218

219219
/**
@@ -223,8 +223,7 @@ export class LumClient {
223223
* @param includeProof whether or not to include proof of the transaction inclusion in the block
224224
*/
225225
getTx = async (hash: Uint8Array, includeProof?: boolean): Promise<LumTypes.TxResponse | null> => {
226-
const result = await this.tmClient.tx({ hash: hash, prove: includeProof });
227-
return result;
226+
return this.tmClient.tx({ hash: hash, prove: includeProof });
228227
};
229228

230229
/**
@@ -274,7 +273,7 @@ export class LumClient {
274273
* @param doc document to sign
275274
*/
276275
signTx = async (wallet: LumWallet | LumWallet[], doc: LumTypes.Doc): Promise<Uint8Array> => {
277-
let wallets: LumWallet[] = [];
276+
let wallets: LumWallet[];
278277
if (Array.isArray(wallet)) {
279278
wallets = wallet;
280279
} else {
@@ -312,8 +311,7 @@ export class LumClient {
312311
* @param tx signed transaction to broadcast
313312
*/
314313
broadcastTx = async (tx: Uint8Array): Promise<LumTypes.BroadcastTxCommitResponse> => {
315-
const response = await this.tmClient.broadcastTxCommit({ tx });
316-
return response;
314+
return this.tmClient.broadcastTxCommit({ tx });
317315
};
318316

319317
/**

src/messages/gov/MsgVote.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const BuildMsgVote = (proposalId: Long, voter: string, option: VoteOption
1313
proposalId,
1414
voter,
1515
option,
16-
metadata
16+
metadata,
1717
} as MsgVote,
1818
};
1919
};

src/registry/aminoTypes.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
import { AminoConverter } from '@cosmjs/stargate';
1+
import {
2+
AminoConverter,
3+
createAuthzAminoConverters,
4+
createBankAminoConverters,
5+
createDistributionAminoConverters,
6+
createFeegrantAminoConverters,
7+
createGovAminoConverters,
8+
createIbcAminoConverters,
9+
createStakingAminoConverters,
10+
createVestingAminoConverters,
11+
} from '@cosmjs/stargate';
212
import { MsgDeposit as MsgDepositDfract } from '../codec/lum-network/dfract/tx';
313
import { AminoMsg, Coin } from '@cosmjs/amino';
414

@@ -14,8 +24,22 @@ export function isAminoMsgDeposit(msg: AminoMsg): msg is AminoMsgDepositDfract {
1424
return msg.type === 'lum-network/MsgDeposit';
1525
}
1626

17-
export const createAminoTypes = (): Record<string, AminoConverter> => {
27+
export const createDefaultAminoTypes = (): { [p: string]: AminoConverter | 'not_supported_by_chain' } => {
1828
return {
29+
...createBankAminoConverters(),
30+
...createAuthzAminoConverters(),
31+
...createDistributionAminoConverters(),
32+
...createGovAminoConverters(),
33+
...createStakingAminoConverters('lum'),
34+
...createIbcAminoConverters(),
35+
...createFeegrantAminoConverters(),
36+
...createVestingAminoConverters(),
37+
};
38+
};
39+
40+
export const createAminoTypes = (): { [p: string]: AminoConverter | 'not_supported_by_chain' } => {
41+
return {
42+
...createDefaultAminoTypes(),
1943
// DFract
2044

2145
'/lum.network.dfract.MsgDeposit': {

0 commit comments

Comments
 (0)