From 6d767cf5b1839ca00360008b91f1e050be32497e Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 7 Jul 2020 09:09:01 +0200 Subject: [PATCH] Improve setupSupplyModule --- packages/sdk38/src/lcdclient.spec.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/sdk38/src/lcdclient.spec.ts b/packages/sdk38/src/lcdclient.spec.ts index bf6f5ebe..acaf33d0 100644 --- a/packages/sdk38/src/lcdclient.spec.ts +++ b/packages/sdk38/src/lcdclient.spec.ts @@ -120,33 +120,29 @@ describe("LcdClient", () => { }; } - interface TotalSupplyReponse { + interface TotalSupplyAllReponse { readonly height: string; readonly result: LcdApiArray; } // eslint-disable-next-line @typescript-eslint/explicit-function-return-type - function registerSupplyModule(base: LcdClient) { + function setupSupplyModule(base: LcdClient) { return { - totalSupply: async (): Promise => { + totalSupplyAll: async (): Promise => { const path = `/supply/total`; - return (await base.get(path)) as TotalSupplyReponse; + return (await base.get(path)) as TotalSupplyAllReponse; }, }; } - const client = LcdClient.withModules( - { apiUrl: wasmd.endpoint }, - registerWasmModule, - registerSupplyModule, - ); + const client = LcdClient.withModules({ apiUrl: wasmd.endpoint }, registerWasmModule, setupSupplyModule); const codes = await client.listCodeInfo(); expect(codes.length).toBeGreaterThanOrEqual(3); expect(codes[0].id).toEqual(deployedErc20.codeId); expect(codes[0].data_hash).toEqual(deployedErc20.checksum.toUpperCase()); expect(codes[0].builder).toEqual(deployedErc20.builder); expect(codes[0].source).toEqual(deployedErc20.source); - const supply = await client.totalSupply(); + const supply = await client.totalSupplyAll(); expect(supply).toEqual({ height: jasmine.stringMatching(/^[0-9]+$/), result: [