Skip to content

Commit

Permalink
chore: release v0.25.1 (#2970)
Browse files Browse the repository at this point in the history
chore: release v0.25.1
  • Loading branch information
ilgooz authored Oct 20, 2022
2 parents deaa513 + b687ef3 commit cc393a9
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 65 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [`v0.25.1`](https://github.com/ignite/cli/releases/tag/v0.25.1)

### Changes

- [#2968](https://github.com/ignite/cli/pull/2968) Dragonberry security fix upgrading Cosmos SDK to `v0.46.3`

# Changelog

## [`v0.25.0`](https://github.com/ignite/cli/releases/tag/v0.25.0)
Expand Down
124 changes: 111 additions & 13 deletions docs/docs/clients/01-typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,32 @@ You will also need to polyfill the client's dependencies. The following is an ex

```bash
npm create vite@latest my-frontend-app -- --template vanilla-ts
npm install --save-dev buffer @rollup/plugin-node-resolve
npm install --save-dev @esbuild-plugins/node-globals-polyfill @rollup/plugin-node-resolve
```

You must then create the necessary `vite.config.ts` file.

```typescript
import { nodeResolve } from '@rollup/plugin-node-resolve'
import { Buffer } from 'buffer'
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
import { defineConfig } from 'vite'
export default defineConfig({
define: {
global: {
Buffer: Buffer
}
},
plugins: [nodeResolve()],
plugins: [nodeResolve()],
optimizeDeps: {
esbuildOptions: {
define: {
global: 'globalThis',
},
plugins: [
NodeGlobalsPolyfillPlugin({
buffer:true
}),
],
},
}
})
```

Expand All @@ -76,17 +85,21 @@ By default, the generated client exports a client class that includes all the Co

To instantiate the client you need to provide environment information (endpoints and chain prefix) and an optional wallet (implementing the CosmJS OfflineSigner interface).

For example, to connect to a local chain instance running under the Ignite CLI defaults, using Keplr as a wallet:
For example, to connect to a local chain instance running under the Ignite CLI defaults, using a CosmJS wallet:

```typescript
import { Client } from '<path-to-ts-client>';
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
const mnemonic = "surround miss nominee dream gap cross assault thank captain prosper drop duty group candy wealth weather scale put";
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic);
const client = new Client({
apiURL: "http://localhost:1317",
rpcURL: "http://localhost:26657",
prefix: "cosmos"
},
window.keplr.getOfflineSigner()
wallet
);
```

Expand Down Expand Up @@ -125,15 +138,18 @@ If you prefer, you can construct a lighter client using only the modules you are
import { IgniteClient } from '<path-to-ts-client>/client';
import { Module as CosmosBankV1Beta1 } from '<path-to-ts-client>/cosmos.bank.v1beta1'
import { Module as CosmosStakingV1Beta1 } from '<path-to-ts-client>/cosmos.staking.v1beta1'
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
const mnemonic = "surround miss nominee dream gap cross assault thank captain prosper drop duty group candy wealth weather scale put";
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic);
const CustomClient = IgniteClient.plugin([CosmosBankV1Beta1, CosmosStakingV1Beta1]);
const client = new CustomClient({
apiURL: "http://localhost:1317",
rpcURL: "http://localhost:26657",
prefix: "cosmos"
},
window.keplr.getOfflineSigner()
wallet
);
```

Expand Down Expand Up @@ -186,9 +202,13 @@ and

```typescript
import { txClient } from '<path-to-ts-client>/cosmos.bank.v1beta1';
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
const mnemonic = "surround miss nominee dream gap cross assault thank captain prosper drop duty group candy wealth weather scale put";
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic);
const client = txClient({
signer: window.keplr.getOfflineSigner(),
signer: wallet,
prefix: 'cosmos',
addr: 'http://localhost:26657'
});
Expand All @@ -209,4 +229,82 @@ const tx_result = await client.sendMsgSend(
memo
}
);
```
```

## Usage with Keplr

Normally, Keplr provides a wallet object implementing the OfflineSigner interface so you can simply replace the wallet argument in client instantiation with it like so:


```typescript
import { Client } from '<path-to-ts-client>';
const chainId = 'mychain-1'
const client = new Client({
apiURL: "http://localhost:1317",
rpcURL: "http://localhost:26657",
prefix: "cosmos"
},
window.keplr.getOfflineSigner(chainId)
);
```

The problem is that for a new Ignite CLI scaffolded chain, Keplr has no knowledge of it thus requiring an initial call to [`experimentalSuggestChain()`](https://docs.keplr.app/api/suggest-chain.html) method to add the chain information to the user's Keplr instance.

The generated client makes this easier by offering a `useKeplr()` method that autodiscovers the chain information and sets it up for you. Thus you can instantiate the client without a wallet and then call `useKeplr()` to enable transacting via Keplr like so:

```typescript
import { Client } from '<path-to-ts-client>';
const client = new Client({
apiURL: "http://localhost:1317",
rpcURL: "http://localhost:26657",
prefix: "cosmos"
}
);
await client.useKeplr();
```

`useKeplr()` optionally accepts an object argument that contains one or more of the same keys as the `ChainInfo` type argument of `experimentalSuggestChain()` allowing you to override the auto-discovered values.

For example, the default chain name and token precision (which are not recorded on-chain) are set to `<chainId> Network` and `0` while the ticker for the denom is set to the denom name in uppercase. If you wanted to override these, you could do something like:


```typescript
import { Client } from '<path-to-ts-client>';
const client = new Client({
apiURL: "http://localhost:1317",
rpcURL: "http://localhost:26657",
prefix: "cosmos"
}
);
await client.useKeplr({ chainName: 'My Great Chain', stakeCurrency : { coinDenom: 'TOKEN', coinMinimalDenom: 'utoken', coinDecimals: '6' } });
```

## Wallet switching

The client also allows you to switch out the wallet for a different one on an already instantiated client like so:

```typescript
import { Client } from '<path-to-ts-client>';
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
const mnemonic = "surround miss nominee dream gap cross assault thank captain prosper drop duty group candy wealth weather scale put";
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic);
const client = new Client({
apiURL: "http://localhost:1317",
rpcURL: "http://localhost:26657",
prefix: "cosmos"
}
);
await client.useKeplr();
// transact using Keplr Wallet
client.useSigner(wallet);
//transact using CosmJS wallet
```
32 changes: 16 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/buger/jsonparser v1.1.1
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/charmbracelet/glow v1.4.0
github.com/cosmos/cosmos-sdk v0.46.2
github.com/cosmos/cosmos-sdk v0.46.3
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/ibc-go/v5 v5.0.0
github.com/docker/docker v20.10.17+incompatible
Expand Down Expand Up @@ -53,7 +53,7 @@ require (
github.com/takuoki/gocase v1.0.0
github.com/tendermint/flutter/v2 v2.0.4
github.com/tendermint/spn v0.2.1-0.20220921200247-8bafad876bdd
github.com/tendermint/tendermint v0.34.21
github.com/tendermint/tendermint v0.34.22
github.com/tendermint/tm-db v0.6.7
github.com/vektra/mockery/v2 v2.14.0
go.etcd.io/bbolt v1.3.6
Expand All @@ -63,7 +63,7 @@ require (
golang.org/x/text v0.3.7
golang.org/x/tools v0.1.13-0.20220803210227-8b9a1fbdf5c3
golang.org/x/vuln v0.0.0-20220919155316-41b1fc70d0a6
google.golang.org/grpc v1.49.0
google.golang.org/grpc v1.50.0
google.golang.org/protobuf v1.28.1
gopkg.in/yaml.v2 v2.4.0
mvdan.cc/gofumpt v0.3.1
Expand All @@ -82,7 +82,7 @@ require (
github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/Microsoft/hcsshim v0.9.3 // indirect
github.com/Microsoft/hcsshim v0.9.4 // indirect
github.com/OpenPeeDeeP/depguard v1.1.0 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/Workiva/go-datastructures v1.0.53 // indirect
Expand Down Expand Up @@ -121,11 +121,11 @@ require (
github.com/confio/ics23/go v0.7.0 // indirect
github.com/containerd/cgroups v1.0.3 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/containerd/containerd v1.6.6 // indirect
github.com/containerd/containerd v1.6.8 // indirect
github.com/cosmos/btcutil v1.0.4 // indirect
github.com/cosmos/cosmos-proto v1.0.0-alpha7 // indirect
github.com/cosmos/gorocksdb v1.2.0 // indirect
github.com/cosmos/iavl v0.19.2-0.20220916140702-9b6be3095313 // indirect
github.com/cosmos/iavl v0.19.3 // indirect
github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect
github.com/cosmos/ledger-go v0.9.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
Expand Down Expand Up @@ -219,7 +219,7 @@ require (
github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jgautheron/goconst v1.5.1 // indirect
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
Expand Down Expand Up @@ -258,7 +258,7 @@ require (
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/microcosm-cc/bluemonday v1.0.20 // indirect
github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a // indirect
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/moby/sys/mount v0.3.1 // indirect
Expand All @@ -278,7 +278,7 @@ require (
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect
github.com/opencontainers/runc v1.1.3 // indirect
github.com/pelletier/go-toml/v2 v2.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand All @@ -292,7 +292,7 @@ require (
github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
github.com/rakyll/statik v0.1.7 // indirect
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/regen-network/cosmos-proto v0.3.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect
Expand All @@ -303,7 +303,7 @@ require (
github.com/sabhiram/go-gitignore v0.0.0-20180611051255-d3107576ba94 // indirect
github.com/sahilm/fuzzy v0.1.0 // indirect
github.com/sanposhiho/wastedassign/v2 v2.0.6 // indirect
github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
github.com/sashamelentyev/usestdlibvars v1.13.0 // indirect
github.com/securego/gosec/v2 v2.13.1 // indirect
Expand All @@ -320,11 +320,11 @@ require (
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.12.0 // indirect
github.com/spf13/viper v1.13.0 // indirect
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/subosito/gotenv v1.4.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/sylvia7788/contextcheck v1.0.6 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/tdakkota/asciicheck v0.1.1 // indirect
Expand All @@ -349,17 +349,17 @@ require (
github.com/zondax/hid v0.9.1-0.20220302062450-5552068d2266 // indirect
gitlab.com/bosi/decorder v0.2.3 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect
go.uber.org/zap v1.22.0 // indirect
golang.org/x/crypto v0.0.0-20220924013350-4ba4fb4dd9e7 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d // indirect
golang.org/x/net v0.0.0-20221002022538-bcab6841153b // indirect
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc // indirect
gopkg.in/ini.v1 v1.66.6 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
honnef.co/go/tools v0.3.3 // indirect
Expand Down
Loading

0 comments on commit cc393a9

Please sign in to comment.