diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 0000000..665bf13 --- /dev/null +++ b/docs/_config.yml @@ -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 diff --git a/docs/cli.md b/docs/cli.md new file mode 100644 index 0000000..a6c49e0 --- /dev/null +++ b/docs/cli.md @@ -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 +``` diff --git a/docs/clients/reading/CosmWasmClient.md b/docs/clients/reading/CosmWasmClient.md new file mode 100644 index 0000000..ece576c --- /dev/null +++ b/docs/clients/reading/CosmWasmClient.md @@ -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_ | diff --git a/docs/clients/reading/index.md b/docs/clients/reading/index.md new file mode 100644 index 0000000..ee44af6 --- /dev/null +++ b/docs/clients/reading/index.md @@ -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. diff --git a/docs/clients/reading/queries/auth.md b/docs/clients/reading/queries/auth.md new file mode 100644 index 0000000..ada0b07 --- /dev/null +++ b/docs/clients/reading/queries/auth.md @@ -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) diff --git a/docs/clients/reading/queries/bank.md b/docs/clients/reading/queries/bank.md new file mode 100644 index 0000000..e8ea708 --- /dev/null +++ b/docs/clients/reading/queries/bank.md @@ -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) diff --git a/docs/clients/reading/queries/distribution.md b/docs/clients/reading/queries/distribution.md new file mode 100644 index 0000000..73ac1f0 --- /dev/null +++ b/docs/clients/reading/queries/distribution.md @@ -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) diff --git a/docs/clients/reading/queries/gov.md b/docs/clients/reading/queries/gov.md new file mode 100644 index 0000000..c635308 --- /dev/null +++ b/docs/clients/reading/queries/gov.md @@ -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) diff --git a/docs/clients/reading/queries/ibc.md b/docs/clients/reading/queries/ibc.md new file mode 100644 index 0000000..8fc6528 --- /dev/null +++ b/docs/clients/reading/queries/ibc.md @@ -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) diff --git a/docs/clients/reading/queries/index.md b/docs/clients/reading/queries/index.md new file mode 100644 index 0000000..bd76d0b --- /dev/null +++ b/docs/clients/reading/queries/index.md @@ -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) diff --git a/docs/clients/reading/queries/mint.md b/docs/clients/reading/queries/mint.md new file mode 100644 index 0000000..e72e53b --- /dev/null +++ b/docs/clients/reading/queries/mint.md @@ -0,0 +1,28 @@ +--- +title: Mint Queries +parent: Advanced Queries +grand_parent: Reading +nav_order: 6 +--- + +# Mint queries + +## Create a queryClient + +```ts +// Instantiate tmClient +const tmClient = await Tendermint34Client.connect(rpcUrl); + +// Create client with mintExtension +const client = QueryClient.withExtensions(tmClient, setupMintExtension); +``` + +## Available query methods + +| Method | Description | Params | +| :--------------------- | :---------- | :------------- | +| .mint.param | | _none_ | +| .mint.inflation | | _Params: none_ | +| .mint.annualProvisions | | _Params: none_ | + +🔗 [Back to query overview](index.md) diff --git a/docs/clients/reading/queries/staking.md b/docs/clients/reading/queries/staking.md new file mode 100644 index 0000000..a444ccb --- /dev/null +++ b/docs/clients/reading/queries/staking.md @@ -0,0 +1,39 @@ +--- +title: Staking Queries +parent: Advanced Queries +grand_parent: Reading +nav_order: 7 +--- + +# Staking queries + +## Create a queryClient + +```ts +// Instantiate tmClient +const tmClient = await Tendermint34Client.connect(rpcUrl); + +// Create client with stakingExtension +const client = QueryClient.withExtensions(tmClient, setupStakingExtension); +``` + +## Available query methods + +| Method | Description | Params | +| :------------------------------------- | :---------- | :------------------------------------------------------------------------------------------------------------------------- | +| .staking.delegation | | _(delegatorAddress: string, validatorAddress: string)_ | +| .staking.delegatorDelegations | | _(delegatorAddress: string,paginationKey?: Uint8Array)_ | +| .staking.delegatorUnbondingDelegations | | _(delegatorAddress: string,paginationKey?: Uint8Array)_ | +| .staking.delegatorValidator | | _(delegatorAddress: string,validatorAddress: string)_ | +| .staking.delegatorValidators | | _(delegatorAddress: string,paginationKey?: Uint8Array)_ | +| .staking.historicalInfo | | _(height: number)_ | +| .staking.params | | _none_ | +| .staking.pool | | _none_ | +| .staking.redelegations | | _(delegatorAddress: string,sourceValidatorAddress: string,destinationValidatorAddress: string,paginationKey?: Uint8Array)_ | +| .staking.unbondingDelegation | | _(delegatorAddress: string,validatorAddress: string)_ | +| .staking.validator | | _(validatorAddress: string)_ | +| .staking.validatorDelegations | | _(validatorAddress: string,paginationKey?: Uint8Array)_ | +| .staking.validators | | _(status: BondStatusString, paginationKey?: Uint8Array)_ | +| .staking.validatorUnbondingDelegations | | _(validatorAddress: string,paginationKey?: Uint8Array)_ | + +🔗 [Back to query overview](index.md) diff --git a/docs/clients/reading/queries/tx.md b/docs/clients/reading/queries/tx.md new file mode 100644 index 0000000..53c4a4e --- /dev/null +++ b/docs/clients/reading/queries/tx.md @@ -0,0 +1,26 @@ +--- +title: Transaction Queries +parent: Advanced Queries +grand_parent: Reading +nav_order: 8 +--- + +# Transaction 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 | +| :-------- | :---------- | :-------------- | +| .tx.getTx | |  *txId: string* | + +🔗 [Back to query overview](index.md) diff --git a/docs/clients/writing/CosmWasmSigningClient/index.md b/docs/clients/writing/CosmWasmSigningClient/index.md new file mode 100644 index 0000000..83ffdc5 --- /dev/null +++ b/docs/clients/writing/CosmWasmSigningClient/index.md @@ -0,0 +1,21 @@ +--- +title: CosmWasmSigningClient +nav_order: 1 +parent: Writing +has_children: true +--- + +# CosmWasmSigningClient + +## About + +The class `CosmWasmSigningClient` is exported from the CosmJS package +`@cosmjs/cosmwasm-stargate` (🔗 +[Link](https://github.com/cosmos/cosmjs/tree/main/packages/cosmwasm-stargate)). + +`CosmWasmSigningClient` extends `CosmWasmClient`, so all methods described in +the 🔗 [CosmWasmClient documentation ](../../reading/CosmWasmClient.md) work here +too. + +This client is used to work with signed transactions. To instantiate it, a +wallet must be connected. For this, please refer to the setup documentation. diff --git a/docs/clients/writing/CosmWasmSigningClient/setup.md b/docs/clients/writing/CosmWasmSigningClient/setup.md new file mode 100644 index 0000000..0de002d --- /dev/null +++ b/docs/clients/writing/CosmWasmSigningClient/setup.md @@ -0,0 +1,120 @@ +--- +title: Setup +nav_order: 1 +parent: CosmWasmSigningClient +grand_parent: Writing +--- + +# Setup of CosmWasmSigningClient + +## Setup functions + +CosmWasmJS is not only a wrapper around CosmJS, but also brings some +preconfigured functions to simplify the setup of SigningClient. + +Basically there are currently 4 different setup functions: + +| Function | Description | +| :-------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| setupWebKeplr | Probably the most frequently used feature in web-based dApps. Returns a client after the user has verified himself in Keplr. Throws a console error if Keplr is not installed in the browser. | +| setupWebLedger | This function is used to log in to web-based dApps with a ledger. (Without Keplr) | +| setupNodeLocal | Herewith a local mnemonic can be used for signing. | +| setupNodeLedger | With the help of this function, a ledger device can be used in a node environment. | + +## Configuration + +All the above functions initially share the following configuration interface: + +```ts +// Configs +const config = { + chainId: "cliffnet-1", + rpcEndpoint: "https://rpc.cliffnet.cosmwasm.com:443/", + prefix: "wasm", +}; +``` + +## Usage + +### Setup Web/Keplr + +To get a CosmWasmSigningClient with Keplr, you don't need additional params. + +```ts +import { setupWebKeplr } from "cosmwasm"; + +// Configs +const config = { + chainId: "cliffnet-1", + rpcEndpoint: "https://rpc.cliffnet.cosmwasm.com:443/", + prefix: "wasm", +}; + +async function getClient() { + return await setupWebKeplr(config); +} +``` + +### Setup Web/Ledger + +To work with a ledger, the following additional NPM package must be installed: +[@ledgerhq/hw-transport-webusb](https://www.npmjs.com/package/@ledgerhq/hw-transport-webusb) +. + +```ts +import { setupWebLedger } from "cosmwasm"; +import TransportWebUSB from "@ledgerhq/hw-transport-webusb"; + +// Configs +const config = { + chainId: "cliffnet-1", + rpcEndpoint: "https://rpc.cliffnet.cosmwasm.com:443/", + prefix: "wasm", +}; + +async function getClient() { + return await setupWebLedger(config, TransportWebUSB); +} +``` + +### Setup Node/Local + +To work with a local mnemonic, it must be provided: + +```ts +import { setupNodeLocal } from "cosmwasm"; + +// Configs +const config = { + chainId: "cliffnet-1", + rpcEndpoint: "https://rpc.cliffnet.cosmwasm.com:443/", + prefix: "wasm", +}; + +const mnemonic = + "lazy year exact gap stem search zero endless question since frost away gaze bike destroy"; + +async function getClient() { + return await setupWebKeplr(config, mnemonic); +} +``` + +### Setup Node/Ledger +To work with a ledger, the following additional NPM package must be installed: +[@ledgerhq/hw-transport-node-hid](https://www.npmjs.com/package/@ledgerhq/hw-transport-node-hid) + +```ts +import { setupWebLedger } from "cosmwasm"; +import TransportNodeHid from "@ledgerhq/hw-transport-node-hid"; + +// Configs +const config = { + chainId: "cliffnet-1", + rpcEndpoint: "https://rpc.cliffnet.cosmwasm.com:443/", + prefix: "wasm", +}; + +async function getClient() { + return await setupWebLedger(config, TransportNodeHid); +} +``` \ No newline at end of file diff --git a/docs/clients/writing/CosmWasmSigningClient/signing.md b/docs/clients/writing/CosmWasmSigningClient/signing.md new file mode 100644 index 0000000..afb08e0 --- /dev/null +++ b/docs/clients/writing/CosmWasmSigningClient/signing.md @@ -0,0 +1,15 @@ +--- +title: Signing +nav_order: 2 +parent: CosmWasmSigningClient +grand_parent: Writing +--- + +# Signing + +In general, there are two different methods that can be used to sign transactions: + +| Method | Description | Params | +| :------------------ | :----------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------- | +| .signAndBroadcast() | Signs the given message and broadcasts it to the blockchain. | _signerAddress: string, messages: readonly EncodeObject[], fee: StdFee / "auto" / number, memo = ""_ | +| .sign() | Signs the given message without broadcasting it. | _signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, explicitSignerData?: SignerData_ | diff --git a/docs/clients/writing/index.md b/docs/clients/writing/index.md new file mode 100644 index 0000000..4239bc7 --- /dev/null +++ b/docs/clients/writing/index.md @@ -0,0 +1,11 @@ +--- +title: Writing +nav_order: 4 +has_children: true +--- + +# Writing / Signing + +We basically distinguish between reading and writing actions. Write actions +refer to all transactions that need to be signed. This also includes the +execution of a method of a smart contract. diff --git a/docs/get-started.md b/docs/get-started.md new file mode 100644 index 0000000..9229ecb --- /dev/null +++ b/docs/get-started.md @@ -0,0 +1,43 @@ +--- +title: Get started +nav_order: 2 +--- +# Get Started + +## Installation + +**Yarn** + +`yarn add cosmwasm` + +**NPM** + +`npm i cosmwasm` + +So your `package.json` should look like: + +```json +{ + "name": "cosmwasm", + "version": "1.0.0", + "description": "Your Project", + "dependencies": { + "cosmwasm": "latest", + ... + }, + ... +} +``` + +# Basics + +## Clients + +You don't need to do any configuration to get started. It is only important to understand when you need to import which symbols from the package. + +Basically there are 2 different clients: +- **CosmWasmClient** +This client can only read. You do not need to have a wallet to instantiate this one. Only an rpcUrl is needed. For a more detailed description please refer to the 🔗 [CosmWasmClient Docs](clients/reading/CosmWasmClient.md). + +- **CosmWasmSigningClient** +This client can also write. In order to instantiate it, a wallet must be specified in addition to the rpcUrl. To facilitate the instantiation, CosmWasmJS already comes with some setup functions. For a more detailed description please refer to the 🔗 [CosmWasmSigningClient Docs](clients/writing/CosmWasmSigningClient.md). \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..9afbfa3 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,23 @@ +--- +title: Intro +nav_order: 1 +--- + +![Logo](logo.png) + +# Introduction + +## What is CosmJS? +CosmJS is the Swiss Army knife to power JavaScript based client solutions ranging from Web apps/explorers over browser extensions to server-side clients like faucets/scrapers in the Cosmos ecosystem. + +"Cosm" is short for Cosmos and "JS" is short for runs everywhere – we actually develop in TypeScript. + +## Why CosmWasmJS? +Because CosmJS tries to cover all client solutions for the Cosmos ecosystem, it can quickly become difficult for new developers to understand how to get started. + +CosmWasmJS was created exclusively for dApp developers and combines the necessary features from CosmJS with powerful helper functions to support especially new devs. + +[🚀 Get started](get-started.md){: .btn .btn-purple } + +This documentation is maintained by [msteiner96](https://github.com/msteiner96)([Confio](https://github.com/confio/)) +{: .fs-2 } \ No newline at end of file diff --git a/src/stargate.ts b/src/stargate.ts index 53026a4..5cdeedf 100644 --- a/src/stargate.ts +++ b/src/stargate.ts @@ -1 +1,22 @@ export { Block, GasPrice, IndexedTx, QueryClient } from "@cosmjs/stargate"; + +// Queries +export { + AuthExtension, + BankExtension, + createPagination, + DistributionExtension, + GovExtension, + IbcExtension, + MintExtension, + setupAuthExtension, + setupBankExtension, + setupDistributionExtension, + setupGovExtension, + setupIbcExtension, + setupMintExtension, + setupStakingExtension, + setupTxExtension, + StakingExtension, + TxExtension, +} from "@cosmjs/stargate";