stargate: Update to assertDefinedAndNotNull

This commit is contained in:
willclarktech 2021-01-13 16:34:20 +00:00
parent dc9b8370b2
commit b967327c67
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7
2 changed files with 5 additions and 7 deletions

View File

@ -3,7 +3,7 @@ import { iavlSpec, ics23, tendermintSpec, verifyExistence, verifyNonExistence }
import { toAscii, toHex } from "@cosmjs/encoding";
import { firstEvent } from "@cosmjs/stream";
import { Client as TendermintClient, Header, NewBlockHeaderEvent, ProofOp } from "@cosmjs/tendermint-rpc";
import { arrayContentEquals, assert, assertDefined, isNonNullObject, sleep } from "@cosmjs/utils";
import { arrayContentEquals, assert, assertDefinedAndNotNull, isNonNullObject, sleep } from "@cosmjs/utils";
import { Stream } from "xstream";
type QueryExtensionSetup<P> = (base: QueryClient) => P;
@ -233,7 +233,7 @@ export class QueryClient {
// this must return the header for height+1
// throws an error if height is 0 or undefined
private async getNextHeader(height?: number): Promise<Header> {
assertDefined(height);
assertDefinedAndNotNull(height);
if (height === 0) {
throw new Error("Query returned height 0, cannot prove it");
}

View File

@ -18,7 +18,7 @@ import {
Client as TendermintClient,
DateTime,
} from "@cosmjs/tendermint-rpc";
import { assert, assertDefined } from "@cosmjs/utils";
import { assert, assertDefinedAndNotNull } from "@cosmjs/utils";
import Long from "long";
import { cosmos } from "./codec";
@ -110,10 +110,8 @@ export function accountFromProto(input: IBaseAccount): Account {
}
export function coinFromProto(input: ICoin): Coin {
assertDefined(input.amount);
assertDefined(input.denom);
assert(input.amount !== null);
assert(input.denom !== null);
assertDefinedAndNotNull(input.amount);
assertDefinedAndNotNull(input.denom);
return {
amount: input.amount,
denom: input.denom,