Export normalizeLcdApiArray
This commit is contained in:
@@ -29,6 +29,7 @@ export {
|
||||
LcdClient,
|
||||
LcdModule,
|
||||
NodeInfoResponse,
|
||||
normalizeLcdApiArray,
|
||||
PostTxsResponse,
|
||||
SearchTxsResponse,
|
||||
TxsResponse,
|
||||
|
||||
@@ -18,4 +18,4 @@ export {
|
||||
SearchTxsResponse,
|
||||
TxsResponse,
|
||||
} from "./base";
|
||||
export { LcdApiArray, LcdClient, LcdModule } from "./lcdclient";
|
||||
export { LcdApiArray, LcdClient, LcdModule, normalizeLcdApiArray } from "./lcdclient";
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
} from "../testutils.spec";
|
||||
import { StdFee } from "../types";
|
||||
import { TxsResponse } from "./base";
|
||||
import { LcdApiArray, LcdClient, normalizeArray } from "./lcdclient";
|
||||
import { LcdApiArray, LcdClient, normalizeLcdApiArray } from "./lcdclient";
|
||||
|
||||
/** Deployed as part of scripts/wasmd/init.sh */
|
||||
export const deployedErc20 = {
|
||||
@@ -94,7 +94,7 @@ describe("LcdClient", () => {
|
||||
listCodeInfo: async (): Promise<readonly CodeInfo[]> => {
|
||||
const path = `/wasm/code`;
|
||||
const responseData = (await base.get(path)) as WasmResponse<LcdApiArray<CodeInfo>>;
|
||||
return normalizeArray(unwrapWasmResponse(responseData));
|
||||
return normalizeLcdApiArray(unwrapWasmResponse(responseData));
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -115,7 +115,7 @@ describe("LcdClient", () => {
|
||||
listCodeInfo: async (): Promise<readonly CodeInfo[]> => {
|
||||
const path = `/wasm/code`;
|
||||
const responseData = (await base.get(path)) as WasmResponse<LcdApiArray<CodeInfo>>;
|
||||
return normalizeArray(unwrapWasmResponse(responseData));
|
||||
return normalizeLcdApiArray(unwrapWasmResponse(responseData));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
/** Unfortunately, Cosmos SDK encodes empty arrays as null */
|
||||
export type LcdApiArray<T> = readonly T[] | null;
|
||||
|
||||
export function normalizeArray<T>(backend: LcdApiArray<T>): readonly T[] {
|
||||
export function normalizeLcdApiArray<T>(backend: LcdApiArray<T>): readonly T[] {
|
||||
return backend || [];
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
@@ -27,6 +27,7 @@ export {
|
||||
LcdClient,
|
||||
LcdModule,
|
||||
NodeInfoResponse,
|
||||
normalizeLcdApiArray,
|
||||
PostTxsResponse,
|
||||
SearchTxsResponse,
|
||||
TxsResponse,
|
||||
|
||||
+1
-1
@@ -9,4 +9,4 @@ export {
|
||||
SearchTxsResponse,
|
||||
TxsResponse,
|
||||
} from "./base";
|
||||
export { LcdApiArray, LcdClient, LcdModule } from "./lcdclient";
|
||||
export { LcdApiArray, LcdClient, LcdModule, normalizeLcdApiArray } from "./lcdclient";
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import {
|
||||
} from "./base";
|
||||
/** Unfortunately, Cosmos SDK encodes empty arrays as null */
|
||||
export declare type LcdApiArray<T> = readonly T[] | null;
|
||||
export declare function normalizeArray<T>(backend: LcdApiArray<T>): readonly T[];
|
||||
export declare function normalizeLcdApiArray<T>(backend: LcdApiArray<T>): readonly T[];
|
||||
export declare type LcdModule = Record<string, (...args: any[]) => any>;
|
||||
declare type LcdModuleSetup<M> = (base: LcdClient) => M;
|
||||
export interface LcdClientBaseOptions {
|
||||
|
||||
Reference in New Issue
Block a user