Skip to content

Commit ef7e65a

Browse files
author
Fabrice Bascoulergue
authored
Upgrade base SDKs to 0.42.0 (#23)
* Update codecs and add gov and ibc modules to registry and messages module * Add gov extension to query client * Improve default get account methods to handle all kind of accounts * Add protobuf details * Bump version to 0.4.8 * Update auto generated documentation
1 parent d3b8289 commit ef7e65a

File tree

69 files changed

+10561
-582
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+10561
-582
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,24 @@ Directly importing the CosmJS SDK or other cryptographic library should be consi
7272

7373
Do not hesitate to contribute to this repository. This SDK is intended to be a one-stop-shop for all Lum Network javascript implementations and should definitely be improved over time by all its users.
7474

75+
## Protocol Buffer Codecs
76+
77+
### Introduction
78+
79+
As of [v0.40](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.40.0), the Cosmos SDK uses [protocol buffers](https://developers.google.com/protocol-buffers) as its standard serialization format for blockchain state and wire communication. This library by default supports protocol buffer serialization for many of the standard queries and messages defined by the Cosmos SDK and the Lum Network custom implementations.
80+
81+
### Acquire the definition files
82+
83+
```bash
84+
yarn get-proto
85+
```
86+
87+
### Generate codec files
88+
89+
```bash
90+
yarn define-proto
91+
```
92+
7593
## Contributing
7694

7795
Contributions are most welcome.

docs/lib/classes/lumclient.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ ___
6060

6161
### queryClient
6262

63-
`Readonly` **queryClient**: *QueryClient* & AuthExtension & BankExtension & DistributionExtension & StakingExtension
63+
`Readonly` **queryClient**: *QueryClient* & AuthExtension & BankExtension & DistributionExtension & StakingExtension & GovExtension & BeamExtension
6464

6565
___
6666

docs/lib/modules/lummessages.md

Lines changed: 97 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,40 @@
99
### Variables
1010

1111
- [MsgBeginRedelegateUrl](lummessages.md#msgbeginredelegateurl)
12-
- [MsgCancelBeamUrl](lummessages.md#msgcancelbeamurl)
1312
- [MsgClaimBeamUrl](lummessages.md#msgclaimbeamurl)
1413
- [MsgCreateValidatorUrl](lummessages.md#msgcreatevalidatorurl)
1514
- [MsgDelegateUrl](lummessages.md#msgdelegateurl)
15+
- [MsgDepositUrl](lummessages.md#msgdepositurl)
1616
- [MsgEditValidatorUrl](lummessages.md#msgeditvalidatorurl)
1717
- [MsgFundCommunityPoolUrl](lummessages.md#msgfundcommunitypoolurl)
1818
- [MsgMultiSendUrl](lummessages.md#msgmultisendurl)
1919
- [MsgOpenBeamUrl](lummessages.md#msgopenbeamurl)
2020
- [MsgSendUrl](lummessages.md#msgsendurl)
2121
- [MsgSetWithdrawAddressUrl](lummessages.md#msgsetwithdrawaddressurl)
22+
- [MsgSubmitProposalUrl](lummessages.md#msgsubmitproposalurl)
2223
- [MsgUndelegateUrl](lummessages.md#msgundelegateurl)
2324
- [MsgUpdateBeamUrl](lummessages.md#msgupdatebeamurl)
25+
- [MsgVoteUrl](lummessages.md#msgvoteurl)
2426
- [MsgWithdrawDelegatorRewardUrl](lummessages.md#msgwithdrawdelegatorrewardurl)
2527
- [MsgWithdrawValidatorCommissionUrl](lummessages.md#msgwithdrawvalidatorcommissionurl)
2628

2729
### Functions
2830

2931
- [BuildMsgBeginRedelegate](lummessages.md#buildmsgbeginredelegate)
30-
- [BuildMsgCancelBeam](lummessages.md#buildmsgcancelbeam)
3132
- [BuildMsgClaimBeam](lummessages.md#buildmsgclaimbeam)
3233
- [BuildMsgCreateValidator](lummessages.md#buildmsgcreatevalidator)
3334
- [BuildMsgDelegate](lummessages.md#buildmsgdelegate)
35+
- [BuildMsgDeposit](lummessages.md#buildmsgdeposit)
3436
- [BuildMsgEditValidator](lummessages.md#buildmsgeditvalidator)
3537
- [BuildMsgFundCommunityPool](lummessages.md#buildmsgfundcommunitypool)
3638
- [BuildMsgMultiSend](lummessages.md#buildmsgmultisend)
3739
- [BuildMsgOpenBeam](lummessages.md#buildmsgopenbeam)
3840
- [BuildMsgSend](lummessages.md#buildmsgsend)
3941
- [BuildMsgSetWithdrawAddress](lummessages.md#buildmsgsetwithdrawaddress)
42+
- [BuildMsgSubmitProposal](lummessages.md#buildmsgsubmitproposal)
4043
- [BuildMsgUndelegate](lummessages.md#buildmsgundelegate)
4144
- [BuildMsgUpdateBeam](lummessages.md#buildmsgupdatebeam)
45+
- [BuildMsgVote](lummessages.md#buildmsgvote)
4246
- [BuildMsgWithdrawDelegatorReward](lummessages.md#buildmsgwithdrawdelegatorreward)
4347
- [BuildMsgWithdrawValidatorCommission](lummessages.md#buildmsgwithdrawvalidatorcommission)
4448

@@ -50,12 +54,6 @@
5054

5155
___
5256

53-
### MsgCancelBeamUrl
54-
55-
`Const` **MsgCancelBeamUrl**: */lum.network.beam.MsgCancelBeam*= '/lum.network.beam.MsgCancelBeam'
56-
57-
___
58-
5957
### MsgClaimBeamUrl
6058

6159
`Const` **MsgClaimBeamUrl**: */lum.network.beam.MsgClaimBeam*= '/lum.network.beam.MsgClaimBeam'
@@ -74,6 +72,12 @@ ___
7472

7573
___
7674

75+
### MsgDepositUrl
76+
77+
`Const` **MsgDepositUrl**: */cosmos.gov.v1beta1.MsgDeposit*= '/cosmos.gov.v1beta1.MsgDeposit'
78+
79+
___
80+
7781
### MsgEditValidatorUrl
7882

7983
`Const` **MsgEditValidatorUrl**: */cosmos.staking.v1beta1.MsgEditValidator*= '/cosmos.staking.v1beta1.MsgEditValidator'
@@ -110,6 +114,12 @@ ___
110114

111115
___
112116

117+
### MsgSubmitProposalUrl
118+
119+
`Const` **MsgSubmitProposalUrl**: */cosmos.gov.v1beta1.MsgSubmitProposal*= '/cosmos.gov.v1beta1.MsgSubmitProposal'
120+
121+
___
122+
113123
### MsgUndelegateUrl
114124

115125
`Const` **MsgUndelegateUrl**: */cosmos.staking.v1beta1.MsgUndelegate*= '/cosmos.staking.v1beta1.MsgUndelegate'
@@ -122,6 +132,12 @@ ___
122132

123133
___
124134

135+
### MsgVoteUrl
136+
137+
`Const` **MsgVoteUrl**: */cosmos.gov.v1beta1.MsgVote*= '/cosmos.gov.v1beta1.MsgVote'
138+
139+
___
140+
125141
### MsgWithdrawDelegatorRewardUrl
126142

127143
`Const` **MsgWithdrawDelegatorRewardUrl**: */cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward*= '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward'
@@ -151,31 +167,16 @@ Name | Type |
151167

152168
___
153169

154-
### BuildMsgCancelBeam
155-
156-
`Const`**BuildMsgCancelBeam**(`updater`: *string*, `id`: *string*): [*Message*](../interfaces/lummessages.message.md)
157-
158-
#### Parameters:
159-
160-
Name | Type |
161-
:------ | :------ |
162-
`updater` | *string* |
163-
`id` | *string* |
164-
165-
**Returns:** [*Message*](../interfaces/lummessages.message.md)
166-
167-
___
168-
169170
### BuildMsgClaimBeam
170171

171-
`Const`**BuildMsgClaimBeam**(`claimer`: *string*, `id`: *string*, `secret`: *string*): [*Message*](../interfaces/lummessages.message.md)
172+
`Const`**BuildMsgClaimBeam**(`id`: *string*, `claimerAddress`: *string*, `secret`: *string*): [*Message*](../interfaces/lummessages.message.md)
172173

173174
#### Parameters:
174175

175176
Name | Type |
176177
:------ | :------ |
177-
`claimer` | *string* |
178178
`id` | *string* |
179+
`claimerAddress` | *string* |
179180
`secret` | *string* |
180181

181182
**Returns:** [*Message*](../interfaces/lummessages.message.md)
@@ -218,6 +219,22 @@ Name | Type |
218219

219220
___
220221

222+
### BuildMsgDeposit
223+
224+
`Const`**BuildMsgDeposit**(`proposalId`: Long, `depositor`: *string*, `amount`: [*Coin*](../interfaces/lumtypes.coin.md)[]): [*Message*](../interfaces/lummessages.message.md)
225+
226+
#### Parameters:
227+
228+
Name | Type |
229+
:------ | :------ |
230+
`proposalId` | Long |
231+
`depositor` | *string* |
232+
`amount` | [*Coin*](../interfaces/lumtypes.coin.md)[] |
233+
234+
**Returns:** [*Message*](../interfaces/lummessages.message.md)
235+
236+
___
237+
221238
### BuildMsgEditValidator
222239

223240
`Const`**BuildMsgEditValidator**(`validatorAddress`: *string*, `commissionRate`: *string*, `minSelfDelegation`: *string*, `description?`: [*Description*](../interfaces/lumtypes.description.md)): [*Message*](../interfaces/lummessages.message.md)
@@ -267,18 +284,21 @@ ___
267284

268285
### BuildMsgOpenBeam
269286

270-
`Const`**BuildMsgOpenBeam**(`id`: *string*, `creator`: *string*, `amount`: Long, `secret`: *string*, `reward?`: BeamReward, `review?`: BeamReview): [*Message*](../interfaces/lummessages.message.md)
287+
`Const`**BuildMsgOpenBeam**(`id`: *string*, `creatorAddress`: *string*, `claimAddress`: *string*, `amount`: [*Coin*](../interfaces/lumtypes.coin.md), `secret`: *string*, `schema`: *string*, `data?`: BeamData, `closesAtBlock?`: *number*, `claimExpiresAtBlock?`: *number*): [*Message*](../interfaces/lummessages.message.md)
271288

272289
#### Parameters:
273290

274-
Name | Type |
275-
:------ | :------ |
276-
`id` | *string* |
277-
`creator` | *string* |
278-
`amount` | Long |
279-
`secret` | *string* |
280-
`reward?` | BeamReward |
281-
`review?` | BeamReview |
291+
Name | Type | Default value |
292+
:------ | :------ | :------ |
293+
`id` | *string* | - |
294+
`creatorAddress` | *string* | - |
295+
`claimAddress` | *string* | - |
296+
`amount` | [*Coin*](../interfaces/lumtypes.coin.md) | - |
297+
`secret` | *string* | - |
298+
`schema` | *string* | - |
299+
`data?` | BeamData | - |
300+
`closesAtBlock` | *number* | 0 |
301+
`claimExpiresAtBlock` | *number* | 0 |
282302

283303
**Returns:** [*Message*](../interfaces/lummessages.message.md)
284304

@@ -315,6 +335,22 @@ Name | Type |
315335

316336
___
317337

338+
### BuildMsgSubmitProposal
339+
340+
`Const`**BuildMsgSubmitProposal**(`proposer`: *string*, `initialDeposit`: [*Coin*](../interfaces/lumtypes.coin.md)[], `content?`: Any): [*Message*](../interfaces/lummessages.message.md)
341+
342+
#### Parameters:
343+
344+
Name | Type |
345+
:------ | :------ |
346+
`proposer` | *string* |
347+
`initialDeposit` | [*Coin*](../interfaces/lumtypes.coin.md)[] |
348+
`content?` | Any |
349+
350+
**Returns:** [*Message*](../interfaces/lummessages.message.md)
351+
352+
___
353+
318354
### BuildMsgUndelegate
319355

320356
`Const`**BuildMsgUndelegate**(`delegatorAddress`: *string*, `validatorAddress`: *string*, `amount?`: [*Coin*](../interfaces/lumtypes.coin.md)): [*Message*](../interfaces/lummessages.message.md)
@@ -333,17 +369,38 @@ ___
333369

334370
### BuildMsgUpdateBeam
335371

336-
`Const`**BuildMsgUpdateBeam**(`updater`: *string*, `id`: *string*, `amount`: Long, `reward?`: BeamReward, `review?`: BeamReview): [*Message*](../interfaces/lummessages.message.md)
372+
`Const`**BuildMsgUpdateBeam**(`id`: *string*, `updaterAddress`: *string*, `amount`: [*Coin*](../interfaces/lumtypes.coin.md), `status?`: UNSPECIFIED \| OPEN \| CANCELED \| CLOSED \| UNRECOGNIZED, `data?`: BeamData, `cancelReason?`: *string*, `hideContent?`: *boolean*, `claimAddress?`: *string*, `closesAtBlock?`: *number*, `claimExpiresAtBlock?`: *number*): [*Message*](../interfaces/lummessages.message.md)
373+
374+
#### Parameters:
375+
376+
Name | Type | Default value |
377+
:------ | :------ | :------ |
378+
`id` | *string* | - |
379+
`updaterAddress` | *string* | - |
380+
`amount` | [*Coin*](../interfaces/lumtypes.coin.md) | - |
381+
`status?` | UNSPECIFIED \| OPEN \| CANCELED \| CLOSED \| UNRECOGNIZED | - |
382+
`data?` | BeamData | - |
383+
`cancelReason` | *string* | '' |
384+
`hideContent` | *boolean* | false |
385+
`claimAddress` | *string* | '' |
386+
`closesAtBlock` | *number* | 0 |
387+
`claimExpiresAtBlock` | *number* | 0 |
388+
389+
**Returns:** [*Message*](../interfaces/lummessages.message.md)
390+
391+
___
392+
393+
### BuildMsgVote
394+
395+
`Const`**BuildMsgVote**(`proposalId`: Long, `voter`: *string*, `option`: VoteOption): [*Message*](../interfaces/lummessages.message.md)
337396

338397
#### Parameters:
339398

340399
Name | Type |
341400
:------ | :------ |
342-
`updater` | *string* |
343-
`id` | *string* |
344-
`amount` | Long |
345-
`reward?` | BeamReward |
346-
`review?` | BeamReview |
401+
`proposalId` | Long |
402+
`voter` | *string* |
403+
`option` | VoteOption |
347404

348405
**Returns:** [*Message*](../interfaces/lummessages.message.md)
349406

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lum-network/sdk-javascript",
3-
"version": "0.4.7",
3+
"version": "0.4.8",
44
"license": "Apache-2.0",
55
"description": "Javascript SDK library for NodeJS and Web browsers to interact with the Lum Network.",
66
"homepage": "https://github.com/lum-network/sdk-javascript#readme",
@@ -35,18 +35,18 @@
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": "REF=v0.40.0 sh ./scripts/get-proto.sh",
38+
"get-proto": "CREF=v0.42.0 LREF=master 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/crypto": "^v0.25.2",
44-
"@cosmjs/encoding": "^0.25.2",
45-
"@cosmjs/math": "^0.25.2",
46-
"@cosmjs/proto-signing": "^0.25.2",
47-
"@cosmjs/stargate": "^0.25.2",
48-
"@cosmjs/tendermint-rpc": "^0.25.2",
49-
"@cosmjs/utils": "^0.25.2",
43+
"@cosmjs/crypto": "^0.26.0",
44+
"@cosmjs/encoding": "^0.26.0",
45+
"@cosmjs/math": "^0.26.0",
46+
"@cosmjs/proto-signing": "^0.26.0",
47+
"@cosmjs/stargate": "^0.26.0",
48+
"@cosmjs/tendermint-rpc": "^0.26.0",
49+
"@cosmjs/utils": "^0.26.0",
5050
"@ledgerhq/hw-app-cosmos": "^5.46.0",
5151
"@ledgerhq/hw-transport": "^5.46.0",
5252
"@types/crypto-js": "^4.0.1",

scripts/define-proto.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,24 @@ protoc \
3636
"$COSMOS_PROTO_DIR/cosmos/staking/v1beta1/query.proto" \
3737
"$COSMOS_PROTO_DIR/cosmos/staking/v1beta1/staking.proto" \
3838
"$COSMOS_PROTO_DIR/cosmos/staking/v1beta1/tx.proto" \
39+
"$COSMOS_PROTO_DIR/cosmos/gov/v1beta1/query.proto" \
40+
"$COSMOS_PROTO_DIR/cosmos/gov/v1beta1/gov.proto" \
41+
"$COSMOS_PROTO_DIR/cosmos/gov/v1beta1/tx.proto" \
3942
"$COSMOS_PROTO_DIR/cosmos/tx/signing/v1beta1/signing.proto" \
4043
"$COSMOS_PROTO_DIR/cosmos/tx/v1beta1/tx.proto" \
44+
"$COSMOS_PROTO_DIR/cosmos/vesting/v1beta1/vesting.proto" \
45+
"$COSMOS_PROTO_DIR/ibc/applications/transfer/v1/tx.proto" \
46+
"$COSMOS_PROTO_DIR/ibc/core/channel/v1/channel.proto" \
47+
"$COSMOS_PROTO_DIR/ibc/core/channel/v1/query.proto" \
48+
"$COSMOS_PROTO_DIR/ibc/core/channel/v1/tx.proto" \
49+
"$COSMOS_PROTO_DIR/ibc/core/client/v1/client.proto" \
50+
"$COSMOS_PROTO_DIR/ibc/core/client/v1/query.proto" \
51+
"$COSMOS_PROTO_DIR/ibc/core/client/v1/tx.proto" \
52+
"$COSMOS_PROTO_DIR/ibc/core/commitment/v1/commitment.proto" \
53+
"$COSMOS_PROTO_DIR/ibc/core/connection/v1/connection.proto" \
54+
"$COSMOS_PROTO_DIR/ibc/core/connection/v1/query.proto" \
55+
"$COSMOS_PROTO_DIR/ibc/core/connection/v1/tx.proto" \
56+
"$COSMOS_PROTO_DIR/ibc/lightclients/tendermint/v1/tendermint.proto" \
4157
"$THIRD_PARTY_PROTO_DIR/confio/proofs.proto" \
4258
"$THIRD_PARTY_PROTO_DIR/tendermint/abci/types.proto" \
4359
"$THIRD_PARTY_PROTO_DIR/tendermint/crypto/keys.proto" \

scripts/get-proto.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,28 @@ LUM_NETWORK_DIR="$PROTO_DIR/lum-network"
1111
LUM_NETWORK_SDK_DIR="$LUM_NETWORK_DIR/chain"
1212
ZIP_LUM_FILE="$LUM_NETWORK_DIR/tmp.zip"
1313

14-
REF=${REF:-"master"}
15-
SUFFIX=${REF}
14+
CREF=${CREF:-"master"}
15+
CSUFFIX=${CREF}
16+
[[ $CSUFFIX =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]] && CSUFFIX=${CSUFFIX#v}
1617

17-
[[ $SUFFIX =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]] && SUFFIX=${SUFFIX#v}
18+
LREF=${LREF:-"master"}
19+
LSUFFIX=${LREF}
20+
[[ $LSUFFIX =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]] && LSUFFIX=${LSUFFIX#v}
1821

1922
# Create the cosmos dir
2023
mkdir -p "$COSMOS_DIR"
2124

2225
# Download the cosmos archive
23-
wget -qO "$ZIP_FILE" "https://github.com/cosmos/cosmos-sdk/archive/$REF.zip"
26+
wget -qO "$ZIP_FILE" "https://github.com/cosmos/cosmos-sdk/archive/$CREF.zip"
2427
unzip "$ZIP_FILE" "*.proto" -d "$COSMOS_DIR"
25-
mv "$COSMOS_SDK_DIR-$SUFFIX" "$COSMOS_SDK_DIR"
28+
mv "$COSMOS_SDK_DIR-$CSUFFIX" "$COSMOS_SDK_DIR"
2629
rm "$ZIP_FILE"
2730

2831
# Create the lum network dir
2932
mkdir -p "$LUM_NETWORK_DIR"
3033

3134
# Download the beam archive
32-
wget -qO "$ZIP_LUM_FILE" "https://github.com/lum-network/chain/archive/$REF.zip"
35+
wget -qO "$ZIP_LUM_FILE" "https://github.com/lum-network/chain/archive/$LREF.zip"
3336
unzip "$ZIP_LUM_FILE" "*.proto" -d "$LUM_NETWORK_DIR"
34-
mv "$LUM_NETWORK_SDK_DIR-$SUFFIX" "$LUM_NETWORK_SDK_DIR"
37+
mv "$LUM_NETWORK_SDK_DIR-$LSUFFIX" "$LUM_NETWORK_SDK_DIR"
3538
rm "$ZIP_LUM_FILE"

0 commit comments

Comments
 (0)