Export normalizeLcdApiArray
This commit is contained in:
parent
e121ea9d08
commit
ab4bbb7d28
@ -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 || [];
|
||||
}
|
||||
|
||||
|
||||
1
packages/sdk38/types/index.d.ts
vendored
1
packages/sdk38/types/index.d.ts
vendored
@ -27,6 +27,7 @@ export {
|
||||
LcdClient,
|
||||
LcdModule,
|
||||
NodeInfoResponse,
|
||||
normalizeLcdApiArray,
|
||||
PostTxsResponse,
|
||||
SearchTxsResponse,
|
||||
TxsResponse,
|
||||
|
||||
2
packages/sdk38/types/lcdapi/index.d.ts
vendored
2
packages/sdk38/types/lcdapi/index.d.ts
vendored
@ -9,4 +9,4 @@ export {
|
||||
SearchTxsResponse,
|
||||
TxsResponse,
|
||||
} from "./base";
|
||||
export { LcdApiArray, LcdClient, LcdModule } from "./lcdclient";
|
||||
export { LcdApiArray, LcdClient, LcdModule, normalizeLcdApiArray } from "./lcdclient";
|
||||
|
||||
2
packages/sdk38/types/lcdapi/lcdclient.d.ts
vendored
2
packages/sdk38/types/lcdapi/lcdclient.d.ts
vendored
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user