Rename type to LcdApiArray

This commit is contained in:
Simon Warta
2020-07-07 23:04:37 +02:00
parent 6645bbaad2
commit 4d28701930
3 changed files with 8 additions and 8 deletions
+4 -4
View File
@@ -5,7 +5,7 @@ import { rawSecp256k1PubkeyToAddress } from "./address";
import { Coin } from "./coins";
import { isPostTxFailure } from "./cosmosclient";
import { makeSignBytes } from "./encoding";
import { CosmosSdkArray, LcdClient, normalizeArray } from "./lcdclient";
import { LcdApiArray, LcdClient, normalizeArray } from "./lcdclient";
import { parseLogs } from "./logs";
import { Msg, MsgSend } from "./msgs";
import { makeCosmoshubPath, Secp256k1Pen } from "./pen";
@@ -104,7 +104,7 @@ describe("LcdClient", () => {
return {
listCodeInfo: async (): Promise<readonly CodeInfo[]> => {
const path = `/wasm/code`;
const responseData = (await base.get(path)) as WasmResponse<CosmosSdkArray<CodeInfo>>;
const responseData = (await base.get(path)) as WasmResponse<LcdApiArray<CodeInfo>>;
return normalizeArray(unwrapWasmResponse(responseData));
},
};
@@ -125,7 +125,7 @@ describe("LcdClient", () => {
return {
listCodeInfo: async (): Promise<readonly CodeInfo[]> => {
const path = `/wasm/code`;
const responseData = (await base.get(path)) as WasmResponse<CosmosSdkArray<CodeInfo>>;
const responseData = (await base.get(path)) as WasmResponse<LcdApiArray<CodeInfo>>;
return normalizeArray(unwrapWasmResponse(responseData));
},
};
@@ -133,7 +133,7 @@ describe("LcdClient", () => {
interface TotalSupplyReponse {
readonly height: string;
readonly result: CosmosSdkArray<Coin>;
readonly result: LcdApiArray<Coin>;
}
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
+2 -2
View File
@@ -15,9 +15,9 @@ import {
import { CosmosSdkTx, StdTx } from "./types";
/** Unfortunately, Cosmos SDK encodes empty arrays as null */
export type CosmosSdkArray<T> = ReadonlyArray<T> | null;
export type LcdApiArray<T> = ReadonlyArray<T> | null;
export function normalizeArray<T>(backend: CosmosSdkArray<T>): ReadonlyArray<T> {
export function normalizeArray<T>(backend: LcdApiArray<T>): ReadonlyArray<T> {
return backend || [];
}
+2 -2
View File
@@ -10,8 +10,8 @@ import {
} from "./restclient";
import { CosmosSdkTx, StdTx } from "./types";
/** Unfortunately, Cosmos SDK encodes empty arrays as null */
export declare type CosmosSdkArray<T> = ReadonlyArray<T> | null;
export declare function normalizeArray<T>(backend: CosmosSdkArray<T>): ReadonlyArray<T>;
export declare type LcdApiArray<T> = ReadonlyArray<T> | null;
export declare function normalizeArray<T>(backend: LcdApiArray<T>): ReadonlyArray<T>;
declare type LcdClientModule = Record<string, () => any>;
declare type LcdClientModuleRegisterer<M> = (base: LcdClient) => M;
export declare class LcdClient {