This repository has been archived by the owner on Dec 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Started Docs, Added queries to docs * Changed layouting * Update docs/intro.md Co-authored-by: Simon Warta <[email protected]> * Change intro docs * Reorganize Docs * Add CosmWasmClient Docs * Refer to cosmjs docs * Adding more text to CosmWasmClient docs * Added simple docs for CosmWasmSigningClient * Update docs/queries/overview.md Co-authored-by: Simon Warta <[email protected]> * Rename intro.md to index.md * Set theme jekyll-theme-cayman * Update _config.yml * Update _config.yml * Changed some stuff for jekyll * Fix Doc Navigation * Fix navigation children * Adding grandparent * Update index.md * Rearrange the docs * Describe Methods in tables * Edit configs * Added more docs * Typo * Re-order navigation * Adding cli docs * Adding NL * CLI Docs shouldn't have childs Co-authored-by: Simon Warta <[email protected]>
- Loading branch information
1 parent
2018170
commit 74c529e
Showing
20 changed files
with
730 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# General | ||
title: "CosmWasmJS Docs" | ||
description: "CosmWasJS Docs" | ||
|
||
#Theming | ||
remote_theme: pmarsceill/just-the-docs | ||
color_scheme: "light" | ||
search_enabled: true | ||
logo: "/logo.png" | ||
|
||
# External Links | ||
aux_links: | ||
"CosmWasmJS on Github": | ||
- "//github.com/CosmWasm/CosmWasmJS" | ||
aux_links_new_tab: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: Command Line | ||
nav_order: 5 | ||
--- | ||
|
||
# Command Line Interface (CLI) | ||
|
||
## About | ||
|
||
With CosmWasmJS also comes a command line client, which (because of NPX) does | ||
not necessarily have to be installed in the project, but can also be installed | ||
globally. | ||
|
||
It is completely based on | ||
[@cosmjs/cli](https://www.npmjs.com/package/@cosmjs/cli). | ||
|
||
## Usage | ||
|
||
```sh | ||
npx cosmwasm | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
title: CosmWasmClient | ||
nav_order: 1 | ||
parent: Reading | ||
--- | ||
|
||
# CosmWasmClient | ||
|
||
## About | ||
|
||
The class `CosmWasmClient` is exported from the CosmJS package | ||
`@cosmjs/cosmwasm-stargate` (π | ||
[Link](https://github.com/cosmos/cosmjs/tree/main/packages/cosmwasm-stargate)). | ||
It already comes with a handful of methods that can be used to execute | ||
frequently used queries. | ||
|
||
It is used only to execute queries. **NOT** to work with signed transactions. If | ||
you are looking for the documentation for this, please see the π | ||
[CosmWasmSigningClient documentation](../writing/CosmWasmSigningClient/index.md). | ||
|
||
To execute extended queries, please refer to the π | ||
[Query documentation](queries/index.md). | ||
|
||
## Usage | ||
|
||
```ts | ||
import { CosmWasmClient } from "cosmwasm"; | ||
|
||
// This is your rpc endpoint | ||
const rpcEndpoint = "https://rpc.cliffnet.cosmwasm.com:443/"; | ||
|
||
async function main() { | ||
const client = await CosmWasmClient.connect(rpcEndpoint); | ||
console.log(client);β | ||
} | ||
|
||
main(); | ||
``` | ||
|
||
# Available Methods | ||
|
||
## General | ||
|
||
| Method | Description | Params | | ||
| :------------- | :------------------------------------- | :------------------------------------- | | ||
| .connect() | Returns the client. | _tmClient: Tendermint34Client_ | | ||
| .getChainId() | Get current chain's ID. | _none_ | | ||
| .getHeight() | Get current height of the chain. | _none_ | | ||
| .getAccount() | Get more information about an account. | _searchAddress: string_ | | ||
| .getSequence() | | _address: string_ | | ||
| .getBlock() | | _height?: number_ | | ||
| .getBalance() | | _address: string, searchDenom: string_ | | ||
|
||
## Transactions | ||
|
||
| Method | Description | Params | | ||
| :---------- | :---------- | :-------------------------------------------------- | | ||
| .getTx() | | _id: string_ | | ||
| .searchTx() | | _query: SearchTxQuery, filter: SearchTxFilter = {}_ | | ||
| .txsQuery() | | _query: string_ | | ||
|
||
## Codes | ||
|
||
| Method | Description | Params | | ||
| :---------------- | :---------- | :--------------- | | ||
| .getCodes() | | _none_ | | ||
| .getCodeDetails() | | _codeId: number_ | | ||
|
||
## Smart Contracts | ||
|
||
| Method | Description | Params | | ||
| :-------------------- | :---------- | :--------------------------------------------------- | | ||
| .getContracts() | | _cideId: number_ | | ||
| .getContract() | | _address: string_ | | ||
| .queryContractRaw() | | _address: string, key: Uint8Array_ | | ||
| .queryContractSmart() | | _address: string, queryMsg: Record<string, unknown>_ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
title: Reading | ||
has_children: true | ||
nav_order: 3 | ||
--- | ||
|
||
# Reading / Queries | ||
|
||
We basically distinguish between reading and writing actions. Read actions are | ||
all queries that do not require a signature and therefore do not require a | ||
connected wallet. An example of this is the query of information about a | ||
transaction or the number of tokens of an address. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
title: Auth Queries | ||
parent: Advanced Queries | ||
grand_parent: Reading | ||
nav_order: 1 | ||
--- | ||
|
||
# Auth queries | ||
|
||
## Create a queryClient | ||
|
||
```ts | ||
// Instantiate tmClient | ||
const tmClient = await Tendermint34Client.connect(rpcUrl); | ||
|
||
// Create client with authExtension | ||
const client = QueryClient.withExtensions(tmClient, setupAuthExtension); | ||
``` | ||
|
||
## Available query methods | ||
|
||
| Method | Description | Params | | ||
| :------------ | :---------- | :---------------- | | ||
| .auth.account | | _address: string_ | | ||
|
||
π [Back to query overview](index.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: Bank Queries | ||
parent: Advanced Queries | ||
grand_parent: Reading | ||
nav_order: 2 | ||
--- | ||
|
||
# Bank queries | ||
|
||
## Create a queryClient | ||
|
||
```ts | ||
// Instantiate tmClient | ||
const tmClient = await Tendermint34Client.connect(rpcUrl); | ||
|
||
// Create client with bankExtension | ||
const client = QueryClient.withExtensions(tmClient, setupBankExtension); | ||
``` | ||
|
||
## Available query methods | ||
|
||
| Method | Description | Params | | ||
| :------------------- | :---------- | :------------------------------- | | ||
| .auth.account | | _address: string_ | | ||
| .bank.balance | | _address: string, denom: string_ | | ||
| .bank.allBalances | | _address: string_ | | ||
| .bank.totalSupply | | _none_ | | ||
| .bank.supplyOf | | _denom: string_ | | ||
| .bank.denomMetadata | | _denom: string_ | | ||
| .bank.denomsMetadata | | _none_ | | ||
|
||
π [Back to query overview](index.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
title: Distribution Queries | ||
parent: Advanced Queries | ||
grand_parent: Reading | ||
nav_order: 3 | ||
--- | ||
|
||
# Distribution queries | ||
|
||
## Create a queryClient | ||
|
||
```ts | ||
// Instantiate tmClient | ||
const tmClient = await Tendermint34Client.connect(rpcUrl); | ||
|
||
// Create client with distributionExtension | ||
const client = QueryClient.withExtensions(tmClient, setupDistributionExtension); | ||
``` | ||
|
||
## Available query methods | ||
|
||
| Method | Description | Params | | ||
| :---------------------------------------- | :---------- | :------------------------------------------------------------------------------------------------- | | ||
| .distribution.communityPool | | _none_ | | ||
| .distribution.delegationRewards | | _delegatorAddress: string, validatorAddress: string_ | | ||
| .distribution.delegationTotalRewards | | _delegatorAddress: string_ | | ||
| .distribution.delegatorValidators | | _delegatorAddress: string_ | | ||
| .distribution.delegatorWithdrawAddress | | _delegatorAddress: string_ | | ||
| .distribution.params | | _none_ | | ||
| .distribution.validatorCommission | | _validatorAddress: string_ | | ||
| .distribution.validatorOutstandingRewards | | _validatorAddress: string_ | | ||
| .distribution.validatorSlashes | | _validatorAddress: string, startingHeight: number,endingHeight: number, paginationKey?:Uint8Array_ | | ||
|
||
π [Back to query overview](index.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: Gov Queries | ||
parent: Advanced Queries | ||
grand_parent: Reading | ||
nav_order: 4 | ||
--- | ||
|
||
# Gov queries | ||
|
||
## Create a queryClient | ||
|
||
```ts | ||
// Instantiate tmClient | ||
const tmClient = await Tendermint34Client.connect(rpcUrl); | ||
|
||
// Create client with govExtension | ||
const client = QueryClient.withExtensions(tmClient, setupGovExtension); | ||
``` | ||
|
||
## Available query methods | ||
|
||
| Method | Description | Params | | ||
| :------------- | :---------- | :-------------------------------------------------------------------------------------------- | | ||
| .gov.proposals | | _proposalStatus: ProposalStatus,depositor: string, voter: string, paginationKey?: Uint8Array_ | | ||
| .gov.proposal | | _proposalId: GovProposalId_ | | ||
| .gov.deposits | | _proposalId: GovProposalId, paginationKey?:Uint8Array_ | | ||
| .gov.deposit | | _proposalId: GovProposalId, depositorAddress: string_ | | ||
| .gov.tally | | _proposalId: GovProposalId_ | | ||
| .gov.votes | | _proposalId: GovProposalId, paginationKey?: Uint8Array_ | | ||
| .gov.vote | | _proposalId: GovProposalId, voterAddress: string_ | | ||
|
||
π [Back to query overview](index.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
title: Ibc Queries | ||
parent: Advanced Queries | ||
grand_parent: Reading | ||
nav_order: 5 | ||
--- | ||
|
||
# IBC queries | ||
|
||
## Create a queryClient | ||
|
||
```ts | ||
// Instantiate tmClient | ||
const tmClient = await Tendermint34Client.connect(rpcUrl); | ||
|
||
// Create client with authExtension | ||
const client = QueryClient.withExtensions(tmClient, setupAuthExtension); | ||
``` | ||
|
||
## Available query methods | ||
|
||
### Channel Queries | ||
|
||
| Method | Description | Params | | ||
| :------------------------------------- | :---------- | :------------------------------------------------------------------------------- | | ||
| .ibc.channel.channel | | _portId: string, channelId: string_ | | ||
| .ibc.channel.channels | | _paginationKey?: Uint8Array_ | | ||
| .ibc.channel.allChannels | | _none_ | | ||
| .ibc.channel.connectionChannels | | _connection: string, paginationKey?: Uint8Array_ | | ||
| .ibc.channel.allConnectionChannels | | _connection: string_ | | ||
| .ibc.channel.clientState | | _portId: string, channelId: string_ | | ||
| .ibc.channel.consensusState | | _portId: string,channelId: string,revisionNumber: number,revisionHeight: number_ | | ||
| .ibc.channel.packetCommitment | | _portId: string, channelId: string, sequence: Long_ | | ||
| .ibc.channel.packetCommitments | | _portId: string,channelId: string,paginationKey?: Uint8Array_ | | ||
| .ibc.channel.allPacketCommitments | | _portId: string, channelId: string_ | | ||
| .ibc.channel.packetReceipt | | _portId: string, channelId: string, sequence: number_ | | ||
| .ibc.channel.packetAcknowledgement | | _portId: string,channelId: string, sequence: number_ | | ||
| .ibc.channel.packetAcknowledgements | | _portId: string,channelId: string,paginationKey?: Uint8Array_ | | ||
| .ibc.channel.allPacketAcknowledgements | | _portId: string, channelId: string_ | | ||
| .ibc.channel.unreceivedPackets | | _portId: string,channelId: string, packetCommitmentSequences: number[]_ | | ||
| .ibc.channel.unreceivedAcks | | _portId: string,channelId: string,packetAckSequences: number[]_ | | ||
| .ibc.channel.nextSequenceReceive | | _portId: string,channelId: string_ | | ||
|
||
### Client Queries | ||
|
||
| Method | Description | Params | | ||
| :----------------------------- | :---------- | :-------------------------------------------- | | ||
| .ibc.client.state | | _clientId: string_ | | ||
| .ibc.client.states | | _paginationKey?: Uint8Array_ | | ||
| .ibc.client.allStates | | _none_ | | ||
| .ibc.client.consensusState | | _clientId: string, height?: number_ | | ||
| .ibc.client.consensusStates | | _clientId: string,paginationKey?: Uint8Array_ | | ||
| .ibc.client.allConsensusStates | | _clientId: string_ | | ||
| .ibc.client.params | | _none_ | | ||
| .ibc.client.stateTm | | _clientId: string_ | | ||
| .ibc.client.statesTm | | _paginationKey?: Uint8Array_ | | ||
| .ibc.client.allStatesTm | | _none_ | | ||
| .ibc.client.consensusStateTm | | _clientId: string, height?: Height_ | | ||
|
||
### Connection Queries | ||
|
||
| Method | Description | Params | | ||
| :-------------------------------- | :---------- | :------------------------------------------------------------------- | | ||
| .ibc.connection.connection | | _connectionId: string_ | | ||
| .ibc.connection.connections | | _paginationKey?: Uint8Array_ | | ||
| .ibc.connection.allConnections | | _none_ | | ||
| .ibc.connection.clientConnections | | _clientId: string_ | | ||
| .ibc.connection.clientState | | _connectionId: string_ | | ||
| .ibc.connection.consensusState | | _connectionId: string,revisionNumber: number,revisionHeight: number_ | | ||
|
||
### Transfer Queries | ||
|
||
| Method | Description | Params | | ||
| :--------------------------- | :---------- | :--------------------------- | | ||
| .ibc.transfer.denomTrace | | _hash: string_ | | ||
| .ibc.transfer.denomTraces | | _paginationKey?: Uint8Array_ | | ||
| .ibc.transfer.allDenomTraces | | _none_ | | ||
| .ibc.transfer.params | | _none_ | | ||
|
||
π [Back to query overview](index.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: Advanced Queries | ||
parent: Reading | ||
nav_order: 2 | ||
has_children: true | ||
--- | ||
|
||
# Queries | ||
|
||
If the methods of the CosmWasmClient are no longer sufficient, you can also | ||
instantiate a QueryClient yourself. With the help of various extensions, | ||
different types of queries can be executed. | ||
|
||
## Example | ||
|
||
```ts | ||
import { | ||
SigningCosmWasmClient, | ||
setupStakingExtension, | ||
QueryClient, | ||
} from "cosmwasm"; | ||
|
||
// Get all delegations of a delegator | ||
const getAllDelegations = async (delegator, rpcUrl) => { | ||
// Instantiate tmClient | ||
const tmClient = await Tendermint34Client.connect(rpcUrl); | ||
|
||
// Create client with stakingExtension | ||
const client = QueryClient.withExtensions(tmClient, setupStakingExtension); | ||
|
||
return await client?.staking.delegatorDelegations(delegator); | ||
}; | ||
|
||
const delegations = getAllDelegations("YourDelegatorAddress", "YourRpcUrl"); | ||
|
||
console.log(delegations); | ||
``` | ||
|
||
## Extensions | ||
|
||
Depending on what query is needed, queries are divided into different | ||
extensions: | ||
|
||
- π [AuthExtension](auth.md) Information about an account | ||
- π [BankExtension](bank.md) Information about account balances, denoms and | ||
supply | ||
- π [DistributionExtension](distribution.md) Information about community pools, | ||
delagations/delegators and validators | ||
- π [GovExtension](gov.md) Information about proposals, deposits and votes | ||
- π [IbcExtension](ibc.md) Information about IBC data | ||
- π [MintExtension](mint.md) Information about inflation and provisions | ||
- π [StakingExtension](staking.md) All information about staking related stuff | ||
- π [TxExtension](tx.md) Information about transactions | ||
|
||
π [Back to clients overview](clients.md) |
Oops, something went wrong.