Skip to content

Commit

Permalink
Merge PR cosmos#542: Remove cosmos package in favor of lens & squash …
Browse files Browse the repository at this point in the history
…bugs

* remove cosmos package & squash bugs

* update to use lens

* tmp remove lens

* make trustingperiod() return a time.Duration instead of a string

* tmp fix for trusting periods

* use lens for relayer

* updated lens

* fix dev-env test script

* fix query balance not showing passed keyname

* remove debug output

* fix lgtm warning

* use tagged version of lens

* small changes
  • Loading branch information
jtieri authored Jan 13, 2022
1 parent 0873a8c commit 8cc5b1e
Show file tree
Hide file tree
Showing 25 changed files with 283 additions and 3,099 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
SDKCOMMIT := $(shell go list -m -u -f '{{.Version}}' github.com/cosmos/cosmos-sdk)
GAIA_VERSION := v5.0.4
GAIA_VERSION := v6.0.0
AKASH_VERSION := v0.12.1
OSMOSIS_VERSION := v4.2.0
OSMOSIS_VERSION := v6.0.0
WASMD_VERSION := v0.16.0

GOPATH := $(shell go env GOPATH)
Expand Down
7 changes: 4 additions & 3 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/relayer/relayer"
"github.com/cosmos/relayer/relayer/provider"
"github.com/cosmos/relayer/relayer/provider/cosmos"
"github.com/spf13/cobra"
"github.com/spf13/viper"
lens "github.com/strangelove-ventures/lens/client"
"gopkg.in/yaml.v3"
)

Expand Down Expand Up @@ -366,7 +366,7 @@ type ProviderConfigYAMLWrapper struct {
// NOTE: Add new ProviderConfig types in the map here with the key set equal to the type of ChainProvider (e.g. cosmos, substrate, etc.)
func (pcw *ProviderConfigWrapper) UnmarshalJSON(data []byte) error {
customTypes := map[string]reflect.Type{
"cosmos": reflect.TypeOf(cosmos.CosmosProviderConfig{}),
"cosmos": reflect.TypeOf(lens.ChainClientConfig{}),
}
val, err := UnmarshalJSONProviderConfig(data, customTypes)
if err != nil {
Expand Down Expand Up @@ -418,7 +418,7 @@ func (iw *ProviderConfigYAMLWrapper) UnmarshalYAML(n *yaml.Node) error {

switch iw.Type {
case "cosmos":
iw.Value = new(cosmos.CosmosProviderConfig)
iw.Value = new(lens.ChainClientConfig)
default:
return fmt.Errorf("%s is an invalid chain type, check your config file", iw.Type)
}
Expand Down Expand Up @@ -619,6 +619,7 @@ func initConfig(cmd *cobra.Command) error {
if err != nil {
return fmt.Errorf("Error while building ChainProviders. Err: %s\n", err.Error())
}

chain := &relayer.Chain{ChainProvider: prov}
chain.Init(nil, debug)
chains = append(chains, chain)
Expand Down
10 changes: 7 additions & 3 deletions cmd/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,17 @@ $ %s query balance ibc-0 testkey`,
return errKeyDoesntExist(keyName)
}

coins, err := helpers.QueryBalance(chain, chain.ChainProvider.Address(), showDenoms)
addr, err := chain.ChainProvider.ShowAddress(keyName)
if err != nil {
return err
}

fmt.Println(coins)
coins, err := helpers.QueryBalance(chain, addr, showDenoms)
if err != nil {
return err
}

fmt.Printf("address {%s} balance {%s} \n", addr, coins)
return nil
},
}
Expand Down Expand Up @@ -374,7 +379,6 @@ $ %s query client ibc-0 ibczeroclient --height 1205`,
}

return chain.Print(res, false, false)
//return chain.CLIContext(height).PrintProto(res)
},
}

Expand Down
1 change: 0 additions & 1 deletion cmd/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,6 @@ $ %s tx raw send ibc-0 ibc-1 100000stake cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9
return err
}
dstAddr = dst.String()
fmt.Println(dstAddr)
//done()
} else {
// Don't parse the rest of the dstAddr... it's raw.
Expand Down
11 changes: 8 additions & 3 deletions configs/demo/chains/ibc-0.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
"key": "testkey",
"chain-id": "ibc-0",
"rpc-addr": "http://localhost:26657",
"grpc-addr": "",
"account-prefix": "cosmos",
"keyring-backend": "test",
"gas-adjustment": 1.5,
"gas-prices": "0.025stake",
"trusting-period": "336h",
"timeout": "10s"
"debug": true,
"timeout": "10s",
"output-format": "json",
"sign-mode": "direct"
}
}
}

11 changes: 8 additions & 3 deletions configs/demo/chains/ibc-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
"key": "testkey",
"chain-id": "ibc-1",
"rpc-addr": "http://localhost:26557",
"grpc-addr": "",
"account-prefix": "cosmos",
"keyring-backend": "test",
"gas-adjustment": 1.5,
"gas-prices": "0.025stake",
"trusting-period": "336h",
"timeout": "10s"
"debug": true,
"timeout": "10s",
"output-format": "json",
"sign-mode": "direct"
}
}
}

2 changes: 0 additions & 2 deletions dev-env
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ echo "waiting for blocks..."
sleep 3

rly tx link demo -d -o 3s
echo "ibc-1 addr $(rly keys show ibc-1)"
echo "ibc-0 addr $(rly keys show ibc-0)"
rly tx transfer ibc-0 ibc-1 100000samoleans "$(rly keys show ibc-1)" -d
rly tx transfer ibc-1 ibc-0 100000samoleans "$(rly keys show ibc-0)" -d
sleep 2
Expand Down
40 changes: 21 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,26 @@ go 1.17

require (
github.com/avast/retry-go v2.6.0+incompatible
github.com/cosmos/cosmos-sdk v0.44.3
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/ibc-go/v2 v2.0.0-rc0
github.com/cosmos/cosmos-sdk v0.44.5
github.com/cosmos/ibc-go/v2 v2.0.2
github.com/gin-gonic/gin v1.7.0 // indirect
github.com/go-git/go-git/v5 v5.4.2
github.com/gogo/protobuf v1.3.3
github.com/gorilla/mux v1.8.0 // indirect
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
github.com/ory/dockertest/v3 v3.8.1
github.com/spf13/cobra v1.2.1
github.com/spf13/viper v1.8.1
github.com/stretchr/objx v0.3.0 // indirect
github.com/spf13/viper v1.10.1
github.com/stretchr/testify v1.7.0
github.com/tendermint/tendermint v0.34.14
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
)

require github.com/pkg/errors v0.9.1
require (
github.com/pkg/errors v0.9.1
github.com/strangelove-ventures/lens v0.2.0
)

require (
filippo.io/edwards25519 v1.0.0-beta.2 // indirect
Expand All @@ -35,17 +36,19 @@ require (
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/Workiva/go-datastructures v1.0.52 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/armon/go-metrics v0.3.9 // indirect
github.com/armon/go-metrics v0.3.10 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/btcsuite/btcd v0.22.0-beta // indirect
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/coinbase/rosetta-sdk-go v0.6.10 // indirect
github.com/confio/ics23/go v0.6.6 // indirect
github.com/containerd/continuity v0.2.1 // indirect
github.com/cosmos/iavl v0.17.1 // indirect
github.com/cosmos/btcutil v1.0.4 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/iavl v0.17.3 // indirect
github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect
github.com/cosmos/ledger-go v0.9.2 // indirect
github.com/danieljoos/wincred v1.0.2 // indirect
Expand All @@ -61,17 +64,16 @@ require (
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25 // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/go-kit/kit v0.10.0 // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gogo/gateway v1.1.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
Expand All @@ -82,7 +84,7 @@ require (
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 // indirect
Expand All @@ -107,7 +109,7 @@ require (
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/opencontainers/runc v1.0.3 // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.11.0 // indirect
Expand Down Expand Up @@ -139,15 +141,15 @@ require (
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/zondax/hid v0.9.0 // indirect
go.etcd.io/bbolt v1.3.5 // indirect
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect
golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
golang.org/x/text v0.3.6 // indirect
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
google.golang.org/grpc v1.40.0 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/grpc v1.43.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
nhooyr.io/websocket v1.8.6 // indirect
Expand Down
Loading

0 comments on commit 8cc5b1e

Please sign in to comment.