-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from noislabs/check-types
Check types and fix tendermint
- Loading branch information
Showing
5 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Deno Checks | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
deno-version: [1.35.3] | ||
|
||
steps: | ||
- name: Git Checkout Deno Module | ||
uses: actions/checkout@v2 | ||
- name: Use Deno Version ${{ matrix.deno-version }} | ||
uses: denolib/setup-deno@v2 | ||
with: | ||
deno-version: ${{ matrix.deno-version }} | ||
- name: Check types | ||
run: | | ||
deno check main.ts | ||
deno check *_test.ts | ||
- name: Check formatting | ||
run: deno fmt --check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Tendermint34Client, Tendermint37Client, TendermintClient } from "./deps.ts"; | ||
|
||
export async function connectTendermint(endpoint: string): Promise<TendermintClient> { | ||
// Tendermint/CometBFT 0.34/0.37 auto-detection. Starting with 0.37 we seem to get reliable versions again 🎉 | ||
// Using 0.34 as the fallback. | ||
let tmClient: TendermintClient; | ||
const tm37Client = await Tendermint37Client.connect(endpoint); | ||
const version = (await tm37Client.status()).nodeInfo.version; | ||
if (version.startsWith("0.37.")) { | ||
tmClient = tm37Client; | ||
} else { | ||
tm37Client.disconnect(); | ||
tmClient = await Tendermint34Client.connect(endpoint); | ||
} | ||
return tmClient; | ||
} |