mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-10 21:49:15 +00:00
stargate: Update to assertDefinedAndNotNull
This commit is contained in:
parent
dc9b8370b2
commit
b967327c67
@ -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");
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user