Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,24 @@ Directly importing the CosmJS SDK or other cryptographic library should be consi

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.

## Protocol Buffer Codecs

### Introduction

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.

### Acquire the definition files

```bash
yarn get-proto
```

### Generate codec files

```bash
yarn define-proto
```

## Contributing

Contributions are most welcome.
Expand Down
2 changes: 1 addition & 1 deletion docs/lib/classes/lumclient.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ___

### queryClient

• `Readonly` **queryClient**: *QueryClient* & AuthExtension & BankExtension & DistributionExtension & StakingExtension
• `Readonly` **queryClient**: *QueryClient* & AuthExtension & BankExtension & DistributionExtension & StakingExtension & GovExtension & BeamExtension

___

Expand Down
137 changes: 97 additions & 40 deletions docs/lib/modules/lummessages.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,40 @@
### Variables

- [MsgBeginRedelegateUrl](lummessages.md#msgbeginredelegateurl)
- [MsgCancelBeamUrl](lummessages.md#msgcancelbeamurl)
- [MsgClaimBeamUrl](lummessages.md#msgclaimbeamurl)
- [MsgCreateValidatorUrl](lummessages.md#msgcreatevalidatorurl)
- [MsgDelegateUrl](lummessages.md#msgdelegateurl)
- [MsgDepositUrl](lummessages.md#msgdepositurl)
- [MsgEditValidatorUrl](lummessages.md#msgeditvalidatorurl)
- [MsgFundCommunityPoolUrl](lummessages.md#msgfundcommunitypoolurl)
- [MsgMultiSendUrl](lummessages.md#msgmultisendurl)
- [MsgOpenBeamUrl](lummessages.md#msgopenbeamurl)
- [MsgSendUrl](lummessages.md#msgsendurl)
- [MsgSetWithdrawAddressUrl](lummessages.md#msgsetwithdrawaddressurl)
- [MsgSubmitProposalUrl](lummessages.md#msgsubmitproposalurl)
- [MsgUndelegateUrl](lummessages.md#msgundelegateurl)
- [MsgUpdateBeamUrl](lummessages.md#msgupdatebeamurl)
- [MsgVoteUrl](lummessages.md#msgvoteurl)
- [MsgWithdrawDelegatorRewardUrl](lummessages.md#msgwithdrawdelegatorrewardurl)
- [MsgWithdrawValidatorCommissionUrl](lummessages.md#msgwithdrawvalidatorcommissionurl)

### Functions

- [BuildMsgBeginRedelegate](lummessages.md#buildmsgbeginredelegate)
- [BuildMsgCancelBeam](lummessages.md#buildmsgcancelbeam)
- [BuildMsgClaimBeam](lummessages.md#buildmsgclaimbeam)
- [BuildMsgCreateValidator](lummessages.md#buildmsgcreatevalidator)
- [BuildMsgDelegate](lummessages.md#buildmsgdelegate)
- [BuildMsgDeposit](lummessages.md#buildmsgdeposit)
- [BuildMsgEditValidator](lummessages.md#buildmsgeditvalidator)
- [BuildMsgFundCommunityPool](lummessages.md#buildmsgfundcommunitypool)
- [BuildMsgMultiSend](lummessages.md#buildmsgmultisend)
- [BuildMsgOpenBeam](lummessages.md#buildmsgopenbeam)
- [BuildMsgSend](lummessages.md#buildmsgsend)
- [BuildMsgSetWithdrawAddress](lummessages.md#buildmsgsetwithdrawaddress)
- [BuildMsgSubmitProposal](lummessages.md#buildmsgsubmitproposal)
- [BuildMsgUndelegate](lummessages.md#buildmsgundelegate)
- [BuildMsgUpdateBeam](lummessages.md#buildmsgupdatebeam)
- [BuildMsgVote](lummessages.md#buildmsgvote)
- [BuildMsgWithdrawDelegatorReward](lummessages.md#buildmsgwithdrawdelegatorreward)
- [BuildMsgWithdrawValidatorCommission](lummessages.md#buildmsgwithdrawvalidatorcommission)

Expand All @@ -50,12 +54,6 @@

___

### MsgCancelBeamUrl

• `Const` **MsgCancelBeamUrl**: */lum.network.beam.MsgCancelBeam*= '/lum.network.beam.MsgCancelBeam'

___

### MsgClaimBeamUrl

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

___

### MsgDepositUrl

• `Const` **MsgDepositUrl**: */cosmos.gov.v1beta1.MsgDeposit*= '/cosmos.gov.v1beta1.MsgDeposit'

___

### MsgEditValidatorUrl

• `Const` **MsgEditValidatorUrl**: */cosmos.staking.v1beta1.MsgEditValidator*= '/cosmos.staking.v1beta1.MsgEditValidator'
Expand Down Expand Up @@ -110,6 +114,12 @@ ___

___

### MsgSubmitProposalUrl

• `Const` **MsgSubmitProposalUrl**: */cosmos.gov.v1beta1.MsgSubmitProposal*= '/cosmos.gov.v1beta1.MsgSubmitProposal'

___

### MsgUndelegateUrl

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

___

### MsgVoteUrl

• `Const` **MsgVoteUrl**: */cosmos.gov.v1beta1.MsgVote*= '/cosmos.gov.v1beta1.MsgVote'

___

### MsgWithdrawDelegatorRewardUrl

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

___

### BuildMsgCancelBeam

▸ `Const`**BuildMsgCancelBeam**(`updater`: *string*, `id`: *string*): [*Message*](../interfaces/lummessages.message.md)

#### Parameters:

Name | Type |
:------ | :------ |
`updater` | *string* |
`id` | *string* |

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

___

### BuildMsgClaimBeam

▸ `Const`**BuildMsgClaimBeam**(`claimer`: *string*, `id`: *string*, `secret`: *string*): [*Message*](../interfaces/lummessages.message.md)
▸ `Const`**BuildMsgClaimBeam**(`id`: *string*, `claimerAddress`: *string*, `secret`: *string*): [*Message*](../interfaces/lummessages.message.md)

#### Parameters:

Name | Type |
:------ | :------ |
`claimer` | *string* |
`id` | *string* |
`claimerAddress` | *string* |
`secret` | *string* |

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

___

### BuildMsgDeposit

▸ `Const`**BuildMsgDeposit**(`proposalId`: Long, `depositor`: *string*, `amount`: [*Coin*](../interfaces/lumtypes.coin.md)[]): [*Message*](../interfaces/lummessages.message.md)

#### Parameters:

Name | Type |
:------ | :------ |
`proposalId` | Long |
`depositor` | *string* |
`amount` | [*Coin*](../interfaces/lumtypes.coin.md)[] |

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

___

### BuildMsgEditValidator

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

### BuildMsgOpenBeam

▸ `Const`**BuildMsgOpenBeam**(`id`: *string*, `creator`: *string*, `amount`: Long, `secret`: *string*, `reward?`: BeamReward, `review?`: BeamReview): [*Message*](../interfaces/lummessages.message.md)
▸ `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)

#### Parameters:

Name | Type |
:------ | :------ |
`id` | *string* |
`creator` | *string* |
`amount` | Long |
`secret` | *string* |
`reward?` | BeamReward |
`review?` | BeamReview |
Name | Type | Default value |
:------ | :------ | :------ |
`id` | *string* | - |
`creatorAddress` | *string* | - |
`claimAddress` | *string* | - |
`amount` | [*Coin*](../interfaces/lumtypes.coin.md) | - |
`secret` | *string* | - |
`schema` | *string* | - |
`data?` | BeamData | - |
`closesAtBlock` | *number* | 0 |
`claimExpiresAtBlock` | *number* | 0 |

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

Expand Down Expand Up @@ -315,6 +335,22 @@ Name | Type |

___

### BuildMsgSubmitProposal

▸ `Const`**BuildMsgSubmitProposal**(`proposer`: *string*, `initialDeposit`: [*Coin*](../interfaces/lumtypes.coin.md)[], `content?`: Any): [*Message*](../interfaces/lummessages.message.md)

#### Parameters:

Name | Type |
:------ | :------ |
`proposer` | *string* |
`initialDeposit` | [*Coin*](../interfaces/lumtypes.coin.md)[] |
`content?` | Any |

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

___

### BuildMsgUndelegate

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

### BuildMsgUpdateBeam

▸ `Const`**BuildMsgUpdateBeam**(`updater`: *string*, `id`: *string*, `amount`: Long, `reward?`: BeamReward, `review?`: BeamReview): [*Message*](../interfaces/lummessages.message.md)
▸ `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)

#### Parameters:

Name | Type | Default value |
:------ | :------ | :------ |
`id` | *string* | - |
`updaterAddress` | *string* | - |
`amount` | [*Coin*](../interfaces/lumtypes.coin.md) | - |
`status?` | UNSPECIFIED \| OPEN \| CANCELED \| CLOSED \| UNRECOGNIZED | - |
`data?` | BeamData | - |
`cancelReason` | *string* | '' |
`hideContent` | *boolean* | false |
`claimAddress` | *string* | '' |
`closesAtBlock` | *number* | 0 |
`claimExpiresAtBlock` | *number* | 0 |

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

___

### BuildMsgVote

▸ `Const`**BuildMsgVote**(`proposalId`: Long, `voter`: *string*, `option`: VoteOption): [*Message*](../interfaces/lummessages.message.md)

#### Parameters:

Name | Type |
:------ | :------ |
`updater` | *string* |
`id` | *string* |
`amount` | Long |
`reward?` | BeamReward |
`review?` | BeamReview |
`proposalId` | Long |
`voter` | *string* |
`option` | VoteOption |

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

Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lum-network/sdk-javascript",
"version": "0.4.7",
"version": "0.4.8",
"license": "Apache-2.0",
"description": "Javascript SDK library for NodeJS and Web browsers to interact with the Lum Network.",
"homepage": "https://github.com/lum-network/sdk-javascript#readme",
Expand Down Expand Up @@ -35,18 +35,18 @@
"format": "prettier --write '**/*.{js,jsx,ts,tsx,css,json,md,html,yml}'",
"bump": "npm version",
"preget-proto": "rm -rf proto",
"get-proto": "REF=v0.40.0 sh ./scripts/get-proto.sh",
"get-proto": "CREF=v0.42.0 LREF=master sh ./scripts/get-proto.sh",
"define-proto": "sh ./scripts/define-proto.sh",
"postdefine-proto": "prettier --write \"src/codec/**/*.ts\""
},
"dependencies": {
"@cosmjs/crypto": "^v0.25.2",
"@cosmjs/encoding": "^0.25.2",
"@cosmjs/math": "^0.25.2",
"@cosmjs/proto-signing": "^0.25.2",
"@cosmjs/stargate": "^0.25.2",
"@cosmjs/tendermint-rpc": "^0.25.2",
"@cosmjs/utils": "^0.25.2",
"@cosmjs/crypto": "^0.26.0",
"@cosmjs/encoding": "^0.26.0",
"@cosmjs/math": "^0.26.0",
"@cosmjs/proto-signing": "^0.26.0",
"@cosmjs/stargate": "^0.26.0",
"@cosmjs/tendermint-rpc": "^0.26.0",
"@cosmjs/utils": "^0.26.0",
"@ledgerhq/hw-app-cosmos": "^5.46.0",
"@ledgerhq/hw-transport": "^5.46.0",
"@types/crypto-js": "^4.0.1",
Expand Down
16 changes: 16 additions & 0 deletions scripts/define-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,24 @@ protoc \
"$COSMOS_PROTO_DIR/cosmos/staking/v1beta1/query.proto" \
"$COSMOS_PROTO_DIR/cosmos/staking/v1beta1/staking.proto" \
"$COSMOS_PROTO_DIR/cosmos/staking/v1beta1/tx.proto" \
"$COSMOS_PROTO_DIR/cosmos/gov/v1beta1/query.proto" \
"$COSMOS_PROTO_DIR/cosmos/gov/v1beta1/gov.proto" \
"$COSMOS_PROTO_DIR/cosmos/gov/v1beta1/tx.proto" \
"$COSMOS_PROTO_DIR/cosmos/tx/signing/v1beta1/signing.proto" \
"$COSMOS_PROTO_DIR/cosmos/tx/v1beta1/tx.proto" \
"$COSMOS_PROTO_DIR/cosmos/vesting/v1beta1/vesting.proto" \
"$COSMOS_PROTO_DIR/ibc/applications/transfer/v1/tx.proto" \
"$COSMOS_PROTO_DIR/ibc/core/channel/v1/channel.proto" \
"$COSMOS_PROTO_DIR/ibc/core/channel/v1/query.proto" \
"$COSMOS_PROTO_DIR/ibc/core/channel/v1/tx.proto" \
"$COSMOS_PROTO_DIR/ibc/core/client/v1/client.proto" \
"$COSMOS_PROTO_DIR/ibc/core/client/v1/query.proto" \
"$COSMOS_PROTO_DIR/ibc/core/client/v1/tx.proto" \
"$COSMOS_PROTO_DIR/ibc/core/commitment/v1/commitment.proto" \
"$COSMOS_PROTO_DIR/ibc/core/connection/v1/connection.proto" \
"$COSMOS_PROTO_DIR/ibc/core/connection/v1/query.proto" \
"$COSMOS_PROTO_DIR/ibc/core/connection/v1/tx.proto" \
"$COSMOS_PROTO_DIR/ibc/lightclients/tendermint/v1/tendermint.proto" \
"$THIRD_PARTY_PROTO_DIR/confio/proofs.proto" \
"$THIRD_PARTY_PROTO_DIR/tendermint/abci/types.proto" \
"$THIRD_PARTY_PROTO_DIR/tendermint/crypto/keys.proto" \
Expand Down
17 changes: 10 additions & 7 deletions scripts/get-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,28 @@ LUM_NETWORK_DIR="$PROTO_DIR/lum-network"
LUM_NETWORK_SDK_DIR="$LUM_NETWORK_DIR/chain"
ZIP_LUM_FILE="$LUM_NETWORK_DIR/tmp.zip"

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

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

# Create the cosmos dir
mkdir -p "$COSMOS_DIR"

# Download the cosmos archive
wget -qO "$ZIP_FILE" "https://github.com/cosmos/cosmos-sdk/archive/$REF.zip"
wget -qO "$ZIP_FILE" "https://github.com/cosmos/cosmos-sdk/archive/$CREF.zip"
unzip "$ZIP_FILE" "*.proto" -d "$COSMOS_DIR"
mv "$COSMOS_SDK_DIR-$SUFFIX" "$COSMOS_SDK_DIR"
mv "$COSMOS_SDK_DIR-$CSUFFIX" "$COSMOS_SDK_DIR"
rm "$ZIP_FILE"

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

# Download the beam archive
wget -qO "$ZIP_LUM_FILE" "https://github.com/lum-network/chain/archive/$REF.zip"
wget -qO "$ZIP_LUM_FILE" "https://github.com/lum-network/chain/archive/$LREF.zip"
unzip "$ZIP_LUM_FILE" "*.proto" -d "$LUM_NETWORK_DIR"
mv "$LUM_NETWORK_SDK_DIR-$SUFFIX" "$LUM_NETWORK_SDK_DIR"
mv "$LUM_NETWORK_SDK_DIR-$LSUFFIX" "$LUM_NETWORK_SDK_DIR"
rm "$ZIP_LUM_FILE"
Loading