From c1421be75ddc4a8692d8ced72d1f24e848a2fc15 Mon Sep 17 00:00:00 2001 From: Cameron Gilbert Date: Tue, 18 Jun 2024 16:17:01 -0400 Subject: [PATCH 01/10] feat: staking extension and git submodules --- .github/workflows/test-ts-sdk.yaml | 1 - .gitignore | 4 +-- .gitmodules | 6 +++++ README.md | 9 ++++++- package.json | 3 ++- scripts/build.sh | 18 ++------------ scripts/protocgen.sh | 26 ++++++++++---------- src/sdk/query/index.ts | 1 + src/sdk/query/query.ts | 9 ++++--- src/sdk/query/staking.test.ts | 39 ++++++++++++++++++++++++++++++ src/sdk/query/staking.ts | 29 ++++++++++++++++++++++ 11 files changed, 107 insertions(+), 38 deletions(-) create mode 100644 .gitmodules create mode 100644 src/sdk/query/staking.test.ts create mode 100644 src/sdk/query/staking.ts diff --git a/.github/workflows/test-ts-sdk.yaml b/.github/workflows/test-ts-sdk.yaml index 33830222..a72691ff 100644 --- a/.github/workflows/test-ts-sdk.yaml +++ b/.github/workflows/test-ts-sdk.yaml @@ -38,7 +38,6 @@ jobs: with: node-version: "lts/hydrogen" cache: "yarn" - cache-dependency-path: "**/yarn.lock" - name: yarn install uses: borales/actions-yarn@v4 diff --git a/.gitignore b/.gitignore index 3c400e39..a35f63ba 100644 --- a/.gitignore +++ b/.gitignore @@ -8,8 +8,8 @@ src/gql/utils/generated.ts src/gql/utils/schema.graphql dist **/node_modules/* -nibiru/ - +/nibiru +/cosmos-sdk reports junit.xml diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..f82158ce --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "cosmos-sdk"] + path = cosmos-sdk + url = https://github.com/cosmos/cosmos-sdk +[submodule "nibiru"] + path = nibiru + url = https://github.com/NibiruChain/nibiru diff --git a/README.md b/README.md index 7e013e1a..d7bab78c 100644 --- a/README.md +++ b/README.md @@ -245,7 +245,14 @@ console.log("perpPositions: %o", perpPositions) yarn ``` -4. Lastly, compile the code in each package. +4. Initialize git submodules + + ```sh + git submodule init + git submodule update + ``` + +5. Lastly, compile the code in each package. ```sh yarn build diff --git a/package.json b/package.json index 06d4c777..9bafc309 100644 --- a/package.json +++ b/package.json @@ -117,5 +117,6 @@ "@commitlint/config-conventional" ] }, - "gitHead": "bac1729be8575a9e75bf9e04447a63c45e227c8c" + "gitHead": "bac1729be8575a9e75bf9e04447a63c45e227c8c", + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/scripts/build.sh b/scripts/build.sh index 014725d5..26377f7b 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,22 +1,8 @@ #!/bin/bash set -e -# Test for ./nibiru/ directory -if [ -d "./nibiru/" ]; then - echo "The ./nibiru/ directory exists." - cd nibiru - git checkout main - cd .. -elif [ -d "../nibiru/" ]; then - cd ../nibiru - git checkout main - git pull - cd ../ts-sdk -else - cd .. - git clone git@github.com:NibiruChain/nibiru.git - cd ts-sdk -fi +git submodule init +git submodule update yarn gql-generate & yarn proto-gen yarn build:tsc diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh index 7a68c8e8..7d238ea2 100755 --- a/scripts/protocgen.sh +++ b/scripts/protocgen.sh @@ -11,11 +11,7 @@ set -eo pipefail # PKG_OUT_DIR: Output path where the generated code will go upon # successful execution. NIBIRU_REPO="./nibiru" - -if [ -d "../nibiru/" ]; then - NIBIRU_REPO="../nibiru" -fi - +COSMOS_SDK_REPO="./cosmos-sdk" PKG_OUT_DIR="./src/protojs" # ----------------------------------------------------------------------------- @@ -25,19 +21,20 @@ echo "Removing old src files" rm -rf $PKG_OUT_DIR/ mkdir -p $PKG_OUT_DIR/ -echo "Copying protos from the 'nibiru' repo" -rm -rf proto/ -mkdir -p proto/ -cp -r $NIBIRU_REPO/proto/ proto/ +for dir in $(find $NIBIRU_REPO/proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | uniq | sort); do \ + for file in $(find "${dir}" -maxdepth 1 -name '*.proto'); do + echo "Generating ts proto code for $file" + buf generate --template $NIBIRU_REPO/proto/buf.gen.ts.yaml -o $PKG_OUT_DIR $file + done +done; -for dir in $(find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | uniq | sort); do \ +for dir in $(find $COSMOS_SDK_REPO/x/staking/proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | uniq | sort); do \ for file in $(find "${dir}" -maxdepth 1 -name '*.proto'); do echo "Generating ts proto code for $file" - buf generate --template proto/proto/buf.gen.ts.yaml -o $PKG_OUT_DIR $file + buf generate --template $NIBIRU_REPO/proto/buf.gen.ts.yaml -o $PKG_OUT_DIR $file done done; -rm -rf proto/ yarn generate-barrels # # the `descriptor.ts` file is only used for gogoproto, and it causes issues with TS-generated code rm $PKG_OUT_DIR/google/protobuf/descriptor.ts @@ -50,12 +47,15 @@ rm -rf $PKG_OUT_DIR/cosmos/msg rm $PKG_OUT_DIR/google/api/annotations.ts rm $PKG_OUT_DIR/index.gogoproto.ts rm $PKG_OUT_DIR/index.amino.ts +rm $PKG_OUT_DIR/index.google.ts rm $PKG_OUT_DIR/index.cosmos.msg.v1.ts rm $PKG_OUT_DIR/index.cosmos.msg.ts +rm $PKG_OUT_DIR/index.cosmos.query.v1.ts +rm $PKG_OUT_DIR/index.cosmos.query.ts sed 's/export \* as gogoproto from \"\.\/index\.gogoproto\"\;//' $PKG_OUT_DIR/index.ts > tmpfile && mv tmpfile $PKG_OUT_DIR/index.ts sed 's/export \* as amino from \"\.\/index\.amino\"\;//' $PKG_OUT_DIR/index.ts > tmpfile && mv tmpfile $PKG_OUT_DIR/index.ts sed 's/export \* as google from \"\.\/index\.google\"\;//' $PKG_OUT_DIR/index.ts > tmpfile && mv tmpfile $PKG_OUT_DIR/index.ts sed 's/export \* from \"\.\/google\/api\/annotations\"\;//' $PKG_OUT_DIR/index.google.api.ts > tmpfile && mv tmpfile $PKG_OUT_DIR/index.google.api.ts -sed 's/export \* as protobuf from \"\.\/index.google.protobuf\"\;//' $PKG_OUT_DIR/index.google.ts > tmpfile && mv tmpfile $PKG_OUT_DIR/index.google.ts +# sed 's/export \* as protobuf from \"\.\/index.google.protobuf\"\;//' $PKG_OUT_DIR/index.google.ts > tmpfile && mv tmpfile $PKG_OUT_DIR/index.google.ts sed 's/export \* as msg from \"\.\/index.cosmos.msg\"\;//' $PKG_OUT_DIR/index.cosmos.ts > tmpfile && mv tmpfile $PKG_OUT_DIR/index.cosmos.ts diff --git a/src/sdk/query/index.ts b/src/sdk/query/index.ts index bba5ece6..22e95d02 100644 --- a/src/sdk/query/index.ts +++ b/src/sdk/query/index.ts @@ -7,4 +7,5 @@ export * from "./epochs" export * from "./inflation" export * from "./oracle" export * from "./query" +export * from "./staking" export * from "./sudo" diff --git a/src/sdk/query/query.ts b/src/sdk/query/query.ts index 691c243e..1e8b7081 100644 --- a/src/sdk/query/query.ts +++ b/src/sdk/query/query.ts @@ -8,8 +8,6 @@ import { setupDistributionExtension, setupGovExtension, setupIbcExtension, - setupStakingExtension, - StakingExtension, StargateClient, StargateClientOptions, } from "@cosmjs/stargate" @@ -29,11 +27,13 @@ import { SudoExtension, InflationExtension, setupInflationExtension, + setupStakingExtension, Result, bytesToHex, hexToBytes, setupDevgasExtension, DevgasExtension, + StakeExtension, } from ".." export type NibiruExtensions = StargateQueryClient & @@ -44,7 +44,7 @@ export type NibiruExtensions = StargateQueryClient & DevgasExtension & DistributionExtension & GovExtension & - StakingExtension & + StakeExtension & IbcExtension & WasmExtension & AuthExtension @@ -90,7 +90,8 @@ export class NibiruQuerier extends StargateClient { setupStakingExtension, setupIbcExtension, setupWasmExtension, - setupAuthExtension + setupAuthExtension, + setupStakingExtension ) } diff --git a/src/sdk/query/staking.test.ts b/src/sdk/query/staking.test.ts new file mode 100644 index 00000000..8181c4d4 --- /dev/null +++ b/src/sdk/query/staking.test.ts @@ -0,0 +1,39 @@ +import { QueryClient, coin } from "@cosmjs/stargate" +import * as query from "../../protojs/cosmos/staking/v1beta1/tx" +import { setupStakingExtension } from "." +import Long from "long" + +describe("setupStakingExtension", () => { + const mockBaseQueryClient = {} as QueryClient + + jest.spyOn(query, "MsgClientImpl").mockReturnValue({ + QuerySudoers: jest.fn().mockResolvedValue({ staking: {} }), + } as unknown as query.MsgClientImpl) + + test("should setup sudo extension correctly", () => { + const extension = setupStakingExtension(mockBaseQueryClient) + + expect(extension.staking).toBeDefined() + expect(extension.staking.cancelUnbondingDelegation).toBeInstanceOf(Function) + }) + + describe("sudo.querySudoers", () => { + test("should call QuerySudoersRequest and return the response", async () => { + const querySudoersRequest = jest + .spyOn(query.MsgCancelUnbondingDelegation, "fromPartial") + .mockReturnValue({} as query.MsgCancelUnbondingDelegation) + + const extension = setupStakingExtension(mockBaseQueryClient) + const testArgs = { + validatorAddress: "", + delegatorAddress: "", + amount: coin(1, "unibi"), + creationHeight: new Long(0), + } + const result = await extension.staking.cancelUnbondingDelegation(testArgs) + + expect(querySudoersRequest).toHaveBeenCalledWith(testArgs) + expect(result).toEqual({ staking: {} }) + }) + }) +}) diff --git a/src/sdk/query/staking.ts b/src/sdk/query/staking.ts new file mode 100644 index 00000000..5b09c137 --- /dev/null +++ b/src/sdk/query/staking.ts @@ -0,0 +1,29 @@ +import { createProtobufRpcClient, QueryClient } from "@cosmjs/stargate" +import { + MsgCancelUnbondingDelegation, + MsgCancelUnbondingDelegationResponse, + MsgClientImpl, +} from "../../protojs/cosmos/staking/v1beta1/tx" + +export interface StakeExtension { + readonly staking: Readonly<{ + cancelUnbondingDelegation: ( + args: MsgCancelUnbondingDelegation + ) => Promise + }> +} + +export const setupStakingExtension = (base: QueryClient): StakeExtension => { + const rpcClient = createProtobufRpcClient(base) + const queryService = new MsgClientImpl(rpcClient) + + return { + staking: { + cancelUnbondingDelegation: async (args: MsgCancelUnbondingDelegation) => { + const req = MsgCancelUnbondingDelegation.fromPartial(args) + const resp = await queryService.CancelUnbondingDelegation(req) + return resp + }, + }, + } +} From df2d07dea5f47a851ad724ceae4a3cb5cddd3478 Mon Sep 17 00:00:00 2001 From: Cameron Gilbert Date: Tue, 18 Jun 2024 16:24:27 -0400 Subject: [PATCH 02/10] fix: build --- .github/workflows/test-ts-sdk.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-ts-sdk.yaml b/.github/workflows/test-ts-sdk.yaml index a72691ff..847e0ed1 100644 --- a/.github/workflows/test-ts-sdk.yaml +++ b/.github/workflows/test-ts-sdk.yaml @@ -23,6 +23,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + submodules: "true" - name: Checkout nibiru Repository uses: actions/checkout@v4 From 2ba9e9a93e7632c40bacf7d29135decb73e923b3 Mon Sep 17 00:00:00 2001 From: Cameron Gilbert Date: Wed, 19 Jun 2024 08:42:38 -0400 Subject: [PATCH 03/10] fix: test build --- .github/workflows/release.yaml | 11 +---------- .github/workflows/test-ts-sdk.yaml | 11 +---------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index acfc5022..deed7cf3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -20,16 +20,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - token: ${{ secrets.NIBIBOT_GIT_TOKEN }} - - - name: Checkout nibiru Repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - repository: NibiruChain/nibiru - ref: releases/v0.21.x - path: "nibiru" - token: ${{ secrets.NIBIBOT_GIT_TOKEN }} + submodules: true - name: Setup NodeJS and npm uses: actions/setup-node@v3 diff --git a/.github/workflows/test-ts-sdk.yaml b/.github/workflows/test-ts-sdk.yaml index 847e0ed1..16444ca8 100644 --- a/.github/workflows/test-ts-sdk.yaml +++ b/.github/workflows/test-ts-sdk.yaml @@ -23,16 +23,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - submodules: "true" - - - name: Checkout nibiru Repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - repository: NibiruChain/nibiru - ref: main - path: "nibiru" - token: ${{ secrets.NIBIBOT_GIT_TOKEN }} + submodules: true - name: Setup NodeJS with yarn caching uses: actions/setup-node@v3 From 66453825785052b529314eb58806374f668d1cba Mon Sep 17 00:00:00 2001 From: Cameron Gilbert Date: Wed, 19 Jun 2024 08:45:44 -0400 Subject: [PATCH 04/10] fix: build --- .github/workflows/release.yaml | 2 +- .github/workflows/test-ts-sdk.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index deed7cf3..eda2cc10 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -20,7 +20,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - submodules: true + submodules: recursive - name: Setup NodeJS and npm uses: actions/setup-node@v3 diff --git a/.github/workflows/test-ts-sdk.yaml b/.github/workflows/test-ts-sdk.yaml index 16444ca8..9c4ad130 100644 --- a/.github/workflows/test-ts-sdk.yaml +++ b/.github/workflows/test-ts-sdk.yaml @@ -23,7 +23,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - submodules: true + submodules: recursive - name: Setup NodeJS with yarn caching uses: actions/setup-node@v3 From 474c91424427b0f1682644f8d954d3edbbe87014 Mon Sep 17 00:00:00 2001 From: Cameron Gilbert Date: Wed, 19 Jun 2024 08:51:57 -0400 Subject: [PATCH 05/10] fix: test --- .github/workflows/release.yaml | 7 ++++++- .github/workflows/test-ts-sdk.yaml | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index eda2cc10..5e8720bf 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -20,7 +20,12 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - submodules: recursive + submodules: true + + - name: Git Submodule Update + run: | + git pull --recurse-submodules + git submodule update --remote --recursive - name: Setup NodeJS and npm uses: actions/setup-node@v3 diff --git a/.github/workflows/test-ts-sdk.yaml b/.github/workflows/test-ts-sdk.yaml index 9c4ad130..755abd74 100644 --- a/.github/workflows/test-ts-sdk.yaml +++ b/.github/workflows/test-ts-sdk.yaml @@ -23,7 +23,12 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - submodules: recursive + submodules: true + + - name: Git Submodule Update + run: | + git pull --recurse-submodules + git submodule update --remote --recursive - name: Setup NodeJS with yarn caching uses: actions/setup-node@v3 From 2472200fbd4e2502034de15f8d011a77b5d82c0e Mon Sep 17 00:00:00 2001 From: Cameron Gilbert Date: Wed, 19 Jun 2024 08:58:09 -0400 Subject: [PATCH 06/10] fix: save --- .github/workflows/release.yaml | 5 ----- .github/workflows/test-ts-sdk.yaml | 5 ----- .gitignore | 2 -- .gitmodules | 6 ------ 4 files changed, 18 deletions(-) delete mode 100644 .gitmodules diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5e8720bf..deed7cf3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -22,11 +22,6 @@ jobs: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis submodules: true - - name: Git Submodule Update - run: | - git pull --recurse-submodules - git submodule update --remote --recursive - - name: Setup NodeJS and npm uses: actions/setup-node@v3 with: diff --git a/.github/workflows/test-ts-sdk.yaml b/.github/workflows/test-ts-sdk.yaml index 755abd74..16444ca8 100644 --- a/.github/workflows/test-ts-sdk.yaml +++ b/.github/workflows/test-ts-sdk.yaml @@ -25,11 +25,6 @@ jobs: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis submodules: true - - name: Git Submodule Update - run: | - git pull --recurse-submodules - git submodule update --remote --recursive - - name: Setup NodeJS with yarn caching uses: actions/setup-node@v3 with: diff --git a/.gitignore b/.gitignore index a35f63ba..9cf66a92 100644 --- a/.gitignore +++ b/.gitignore @@ -8,8 +8,6 @@ src/gql/utils/generated.ts src/gql/utils/schema.graphql dist **/node_modules/* -/nibiru -/cosmos-sdk reports junit.xml diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index f82158ce..00000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "cosmos-sdk"] - path = cosmos-sdk - url = https://github.com/cosmos/cosmos-sdk -[submodule "nibiru"] - path = nibiru - url = https://github.com/NibiruChain/nibiru From a2193f18f4bfbaa351e26a3c28f8b74bea423376 Mon Sep 17 00:00:00 2001 From: Cameron Gilbert Date: Wed, 19 Jun 2024 09:00:25 -0400 Subject: [PATCH 07/10] fix: submodule --- .gitignore | 2 -- .gitmodules | 6 ++++++ cosmos-sdk | 1 + nibiru | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .gitmodules create mode 160000 cosmos-sdk create mode 160000 nibiru diff --git a/.gitignore b/.gitignore index 9cf66a92..6e55df51 100644 --- a/.gitignore +++ b/.gitignore @@ -206,5 +206,3 @@ typings/ # End of https://www.gitignore.io/api/node,intellij+all,visualstudiocode .yarn .DS_Store - -nibiru/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..f82158ce --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "cosmos-sdk"] + path = cosmos-sdk + url = https://github.com/cosmos/cosmos-sdk +[submodule "nibiru"] + path = nibiru + url = https://github.com/NibiruChain/nibiru diff --git a/cosmos-sdk b/cosmos-sdk new file mode 160000 index 00000000..b48fd666 --- /dev/null +++ b/cosmos-sdk @@ -0,0 +1 @@ +Subproject commit b48fd66678a98b915888cc84976399ac17164370 diff --git a/nibiru b/nibiru new file mode 160000 index 00000000..98c2b240 --- /dev/null +++ b/nibiru @@ -0,0 +1 @@ +Subproject commit 98c2b240cb61f3f25ca37442c8400cd3a32807e8 From b27e9e6717a2f4271b7be88bc0ae7b670162b6c5 Mon Sep 17 00:00:00 2001 From: Cameron Gilbert Date: Wed, 19 Jun 2024 09:27:24 -0400 Subject: [PATCH 08/10] fix: fix --- .eslintrc.json | 3 ++- .prettierignore | 2 ++ package.json | 4 ++-- src/sdk/query/query.test.ts | 4 ++-- src/sdk/query/query.ts | 7 +++++-- src/sdk/query/staking.test.ts | 6 +++--- src/sdk/query/staking.ts | 2 +- src/sdk/tx/txClient.ts | 2 ++ 8 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 .prettierignore diff --git a/.eslintrc.json b/.eslintrc.json index 6a57aacd..2f8ac782 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -12,5 +12,6 @@ "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended" - ] + ], + "ignorePatterns": ["nibiru/*", "cosmos-sdk/*"] } diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..20abcc21 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +/nibiru +/cosmos-sdk diff --git a/package.json b/package.json index 9bafc309..18e57f97 100644 --- a/package.json +++ b/package.json @@ -94,11 +94,11 @@ "lint-staged": { "*.{js,ts}": [ "eslint --fix . --ignore-path .gitignore", - "prettier --write . --ignore-path .gitignore", + "prettier --write . --ignore-path .prettierignore", "git add ." ], "*.json": [ - "prettier --write . --ignore-path .gitignore", + "prettier --write . --ignore-path .prettierignore", "git add ." ] }, diff --git a/src/sdk/query/query.test.ts b/src/sdk/query/query.test.ts index e2775162..a4984111 100644 --- a/src/sdk/query/query.test.ts +++ b/src/sdk/query/query.test.ts @@ -160,7 +160,7 @@ describe("ibc module queries", () => { "channelId", "counterparty", ] - channels.forEach((channel: any) => { + channels.forEach((channel) => { properties.forEach((prop) => { expect(channel).toHaveProperty(prop) }) @@ -179,7 +179,7 @@ describe("ibc module queries", () => { "delayPeriod", "counterparty", ] - connections.forEach((connection: any) => { + connections.forEach((connection) => { properties.forEach((prop) => { expect(connection).toHaveProperty(prop) }) diff --git a/src/sdk/query/query.ts b/src/sdk/query/query.ts index 1e8b7081..59e2290a 100644 --- a/src/sdk/query/query.ts +++ b/src/sdk/query/query.ts @@ -10,6 +10,8 @@ import { setupIbcExtension, StargateClient, StargateClientOptions, + StakingExtension, + setupStakingExtension, } from "@cosmjs/stargate" import { Tendermint37Client } from "@cosmjs/tendermint-rpc" import { @@ -27,7 +29,7 @@ import { SudoExtension, InflationExtension, setupInflationExtension, - setupStakingExtension, + setupStakeExtension, Result, bytesToHex, hexToBytes, @@ -44,6 +46,7 @@ export type NibiruExtensions = StargateQueryClient & DevgasExtension & DistributionExtension & GovExtension & + StakingExtension & StakeExtension & IbcExtension & WasmExtension & @@ -91,7 +94,7 @@ export class NibiruQuerier extends StargateClient { setupIbcExtension, setupWasmExtension, setupAuthExtension, - setupStakingExtension + setupStakeExtension ) } diff --git a/src/sdk/query/staking.test.ts b/src/sdk/query/staking.test.ts index 8181c4d4..ba06dc87 100644 --- a/src/sdk/query/staking.test.ts +++ b/src/sdk/query/staking.test.ts @@ -1,6 +1,6 @@ import { QueryClient, coin } from "@cosmjs/stargate" import * as query from "../../protojs/cosmos/staking/v1beta1/tx" -import { setupStakingExtension } from "." +import { setupStakeExtension } from "." import Long from "long" describe("setupStakingExtension", () => { @@ -11,7 +11,7 @@ describe("setupStakingExtension", () => { } as unknown as query.MsgClientImpl) test("should setup sudo extension correctly", () => { - const extension = setupStakingExtension(mockBaseQueryClient) + const extension = setupStakeExtension(mockBaseQueryClient) expect(extension.staking).toBeDefined() expect(extension.staking.cancelUnbondingDelegation).toBeInstanceOf(Function) @@ -23,7 +23,7 @@ describe("setupStakingExtension", () => { .spyOn(query.MsgCancelUnbondingDelegation, "fromPartial") .mockReturnValue({} as query.MsgCancelUnbondingDelegation) - const extension = setupStakingExtension(mockBaseQueryClient) + const extension = setupStakeExtension(mockBaseQueryClient) const testArgs = { validatorAddress: "", delegatorAddress: "", diff --git a/src/sdk/query/staking.ts b/src/sdk/query/staking.ts index 5b09c137..a46e00a1 100644 --- a/src/sdk/query/staking.ts +++ b/src/sdk/query/staking.ts @@ -13,7 +13,7 @@ export interface StakeExtension { }> } -export const setupStakingExtension = (base: QueryClient): StakeExtension => { +export const setupStakeExtension = (base: QueryClient): StakeExtension => { const rpcClient = createProtobufRpcClient(base) const queryService = new MsgClientImpl(rpcClient) diff --git a/src/sdk/tx/txClient.ts b/src/sdk/tx/txClient.ts index 81ef2530..33a498e4 100644 --- a/src/sdk/tx/txClient.ts +++ b/src/sdk/tx/txClient.ts @@ -24,6 +24,7 @@ import { setupOracleExtension, setupEpochsExtension, setupDevgasExtension, + setupStakeExtension, } from ".." export const nibiruRegistryTypes: ReadonlyArray<[string, GeneratedType]> = [ @@ -52,6 +53,7 @@ export class NibiruTxClient extends SigningStargateClient { setupDistributionExtension, setupGovExtension, setupStakingExtension, + setupStakeExtension, setupIbcExtension, setupWasmExtension, setupAuthExtension From 79a99f90fd34a7c51fdc956552a01f3a303a0003 Mon Sep 17 00:00:00 2001 From: Cameron Gilbert Date: Wed, 19 Jun 2024 09:27:50 -0400 Subject: [PATCH 09/10] fix: build --- .prettierignore | 211 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 211 insertions(+) diff --git a/.prettierignore b/.prettierignore index 20abcc21..7436e434 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,213 @@ /nibiru /cosmos-sdk + +# Rest of file is .gitignore + +# Created by https://www.gitignore.io/api/node,intellij+all,visualstudiocode +# Edit at https://www.gitignore.io/?templates=node,intellij+all,visualstudiocode + +docs/ +src/protojs/ +proto/ +src/gql/utils/generated.ts +src/gql/utils/schema.graphql +dist +**/node_modules/* + +reports +junit.xml +temp +.build-cache +.DS_STORE + +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage* +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ +**/node_modules/* + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history + +# End of https://www.gitignore.io/api/node,intellij+all,visualstudiocode +.yarn +.DS_Store From 2307d77127e815284c54a7abe801f7ba5824e668 Mon Sep 17 00:00:00 2001 From: Cameron Gilbert Date: Wed, 19 Jun 2024 09:41:39 -0400 Subject: [PATCH 10/10] fix: rem comment --- scripts/protocgen.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh index 7d238ea2..ae5cd124 100755 --- a/scripts/protocgen.sh +++ b/scripts/protocgen.sh @@ -57,5 +57,4 @@ sed 's/export \* as gogoproto from \"\.\/index\.gogoproto\"\;//' $PKG_OUT_DIR/in sed 's/export \* as amino from \"\.\/index\.amino\"\;//' $PKG_OUT_DIR/index.ts > tmpfile && mv tmpfile $PKG_OUT_DIR/index.ts sed 's/export \* as google from \"\.\/index\.google\"\;//' $PKG_OUT_DIR/index.ts > tmpfile && mv tmpfile $PKG_OUT_DIR/index.ts sed 's/export \* from \"\.\/google\/api\/annotations\"\;//' $PKG_OUT_DIR/index.google.api.ts > tmpfile && mv tmpfile $PKG_OUT_DIR/index.google.api.ts -# sed 's/export \* as protobuf from \"\.\/index.google.protobuf\"\;//' $PKG_OUT_DIR/index.google.ts > tmpfile && mv tmpfile $PKG_OUT_DIR/index.google.ts sed 's/export \* as msg from \"\.\/index.cosmos.msg\"\;//' $PKG_OUT_DIR/index.cosmos.ts > tmpfile && mv tmpfile $PKG_OUT_DIR/index.cosmos.ts