From 124c42f6c63e70c33aa8c3eaf033eba6d329cd09 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Mon, 28 Oct 2024 07:55:14 +0400 Subject: [PATCH 1/5] wip --- setup-telescope.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 setup-telescope.sh diff --git a/setup-telescope.sh b/setup-telescope.sh new file mode 100644 index 0000000..febad62 --- /dev/null +++ b/setup-telescope.sh @@ -0,0 +1,6 @@ +brew install yarn # macos + +npm install -g @cosmology/telescope create-cosmos-app + + +cca --boilerplate telescope From c46df4408018bb34f59044431c889bc4d10568ae Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Wed, 30 Oct 2024 12:49:11 -0500 Subject: [PATCH 2/5] telescope wip --- simapp/Makefile | 11 +++++++++++ simapp/README.md | 25 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/simapp/Makefile b/simapp/Makefile index d380edc..7128338 100644 --- a/simapp/Makefile +++ b/simapp/Makefile @@ -325,9 +325,20 @@ explorer: .PHONY: generate-webapp generate-webapp: + ifeq (, $(shell which create-cosmos-app)) +# $(error "No create-cosmos-app in $(PATH), consider doing apt-get install lzop") sudo npm install --global create-cosmos-app + endif cca --name web -e spawn +.PHONY: generate-typescript +generate-typescript: + ifeq (, $(shell which telescope)) + sudo npm install -g @cosmology/telescope + endif + echo "TODO: Run telescope here" + + help: @echo "Usage: make " @echo "" diff --git a/simapp/README.md b/simapp/README.md index d38402c..e8839c7 100644 --- a/simapp/README.md +++ b/simapp/README.md @@ -32,3 +32,28 @@ Generate the template base with spawn. Requires [npm](https://nodejs.org/en/down - `make generate-webapp` *[Cosmology Webapp Template](https://github.com/cosmology-tech/create-cosmos-app)* Start the testnet with `make testnet`, and open the webapp `cd ./web && yarn dev` + +## Typescript Client + + + +```bash + +# Install Telescope + +telescope generate # the chainname-js +cd chainname-js + +telescope install # amino, cosmos, cosmos_proto, gogoproto, google, ibc +# attempt 2: cosmos, cosmos_proto, gogoproto, ibc + +cp -r ../proto/* ./proto # I dislike this step, why? Can't I use the parent package for my custom modules, but then relative for the installed ones? + +telescope transpile + +# install pacakge in +yarn + +# publish +npm publish +``` From 6f9fb544ec69175563cec35bb1a0fe5ae74b21b9 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Wed, 30 Oct 2024 13:17:56 -0500 Subject: [PATCH 3/5] telescope setup guide base --- simapp/README.md | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/simapp/README.md b/simapp/README.md index e8839c7..9fcd368 100644 --- a/simapp/README.md +++ b/simapp/README.md @@ -41,17 +41,30 @@ Start the testnet with `make testnet`, and open the webapp `cd ./web && yarn dev # Install Telescope -telescope generate # the chainname-js -cd chainname-js - -telescope install # amino, cosmos, cosmos_proto, gogoproto, google, ibc -# attempt 2: cosmos, cosmos_proto, gogoproto, ibc +telescope generate --name chain-js # TODO: how do I default set other information? like the __CHAINNAME__ ? + ``` + ? [__CHAINNAME__] Enter chain name in all lowercase, e.g. osmosis localchain + ? [__USERFULLNAME__] Enter author full name reece williams + ? [__USEREMAIL__] Enter author email reecepbcups@gmail.com + ? [__MODULENAME__] Enter the module name chain-js + ? [__MODULEDESC__] Enter the module description desc of chain-js + ? [__USERNAME__] Enter your github username reecepbcups + ? [__ACCESS__] Module access? public + ? [__LICENSE__] Which license? MIT + ? [scoped] use npm scopes? Yes + ``` + +cd chain-js + +telescope install @protobufs/tendermint @protobufs/ibc @protobufs/google @protobufs/gogoproto @protobufs/cosmos_proto @protobufs/cosmos cp -r ../proto/* ./proto # I dislike this step, why? Can't I use the parent package for my custom modules, but then relative for the installed ones? -telescope transpile +telescope transpile --protoDirs=./proto --outPath=./src/codegen --config ../.telescope.json + +yarn add @cosmology/lcd -# install pacakge in +# install package yarn # publish From 8cfda8cd0f7e1a553bf085d946d48902b05f4582 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Wed, 30 Oct 2024 13:34:50 -0500 Subject: [PATCH 4/5] holy wow i did it --- simapp/README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/simapp/README.md b/simapp/README.md index 9fcd368..442664b 100644 --- a/simapp/README.md +++ b/simapp/README.md @@ -70,3 +70,38 @@ yarn # publish npm publish ``` + + +## Connect to a TS locally without publish + +```bash +cd chain-js +yarn link + +mkdir t # testing +cd t + +npm i typescript --save-dev +npx tsc --init + +touch index.ts + + ```ts + import {nameservice} from '@reecepbcups/chain-js'; + + console.log(`Hello world`); + + const client = nameservice.ClientFactory.createRPCQueryClient({ rpcEndpoint: 'http://localhost:26657' }); + + client.then((client) => { + client.nameservice.v1.params().then((res) => { + console.log(res); + }); + }); + ``` + +yarn link "@reecepbcups/chain-js" # TODO: just simlink directly with relative paths + +npx ts-node index.ts + +``` From 44e10effb8a897d92278643f56876bbd5cb0c4d0 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Wed, 30 Oct 2024 13:38:46 -0500 Subject: [PATCH 5/5] fix --- setup-telescope.sh | 6 ------ simapp/README.md | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 setup-telescope.sh diff --git a/setup-telescope.sh b/setup-telescope.sh deleted file mode 100644 index febad62..0000000 --- a/setup-telescope.sh +++ /dev/null @@ -1,6 +0,0 @@ -brew install yarn # macos - -npm install -g @cosmology/telescope create-cosmos-app - - -cca --boilerplate telescope diff --git a/simapp/README.md b/simapp/README.md index 442664b..44fd85d 100644 --- a/simapp/README.md +++ b/simapp/README.md @@ -68,7 +68,7 @@ yarn add @cosmology/lcd yarn # publish -npm publish +# npm publish ```