Skip to content

Commit

Permalink
feat: add staking query extension (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahadoodle authored Feb 13, 2023
1 parent b864c3e commit c16f844
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VALIDATOR_MNEMONIC=
VALIDATOR_ADDRESS=
CHAIN_HOST=
3 changes: 3 additions & 0 deletions packages/nibijs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

* .

## v0.8.6
* feat: Add staking query extension

## v0.8.0

* sync: Update to nibiru v0.16.0-beta.1.
Expand Down
4 changes: 2 additions & 2 deletions packages/nibijs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nibiruchain/nibijs",
"description": "The TypeScript SDK for the Nibiru blockchain.",
"version": "0.8.5",
"version": "0.8.6",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -55,4 +55,4 @@
"typedoc-plugin-markdown": "^3.14.0"
},
"gitHead": "4da45aaaf65a44e6b4edc0b5d11ea1083229f977"
}
}
5 changes: 4 additions & 1 deletion packages/nibijs/src/query/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { setupDexExtension, DexExtension } from "./dex"
import { EpochsExtension, setupEpochsExtension } from "./epochs"
import { setupPerpExtension, PerpExtension } from "./perp"
import { PricefeedExtension, setupPricefeedExtension } from "./pricefeed"
import { setupStakingExtension, StakingExtension } from "./staking"
import { setupVpoolExtension, VpoolExtension } from "./vpool"

export type ExtendedQueryClient = BankExtension &
Expand All @@ -20,7 +21,8 @@ export type ExtendedQueryClient = BankExtension &
PerpExtension &
VpoolExtension &
PricefeedExtension &
EpochsExtension
EpochsExtension &
StakingExtension

export interface IQueryCmd {
/**
Expand Down Expand Up @@ -84,6 +86,7 @@ export class QueryCmd implements IQueryCmd {
setupVpoolExtension,
setupPricefeedExtension,
setupEpochsExtension,
setupStakingExtension,
)
}

Expand Down
9 changes: 9 additions & 0 deletions packages/nibijs/src/test/query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,12 @@ describe("epochs module queries", () => {
timeoutMs,
)
})

describe("staking module queries", () => {
test("nibid query staking validators", async () => {
const { client: query } = await newQueryCmd(chain)
const infoResp = await query.staking.validators("BOND_STATUS_BONDED")
expect(infoResp).toHaveProperty("validators")
expect(infoResp.validators.length).toBeGreaterThan(0)
})
})

0 comments on commit c16f844

Please sign in to comment.