tendermint-rpc: Update adaptorForVersion

This commit is contained in:
willclarktech 2020-11-10 16:03:14 +01:00
parent 2f2ecead94
commit 77602efa6d
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7

View File

@ -4,6 +4,10 @@
import { Adaptor } from "./adaptor";
import { v0_33 } from "./v0-33";
const hashes = {
v0_34: ["ca2c9df"],
};
/**
* Returns an Adaptor implementation for a given tendermint version.
* Throws when version is not supported.
@ -11,7 +15,7 @@ import { v0_33 } from "./v0-33";
* @param version full Tendermint version string, e.g. "0.20.1"
*/
export function adaptorForVersion(version: string): Adaptor {
if (version.startsWith("0.33.") || version.startsWith("0.34.")) {
if (version.startsWith("0.33.") || version.startsWith("0.34.") || hashes.v0_34.includes(version)) {
return v0_33;
} else {
throw new Error(`Unsupported tendermint version: ${version}`);