Remove Private* because fields are public

This commit is contained in:
Simon Warta 2021-05-05 18:43:18 +02:00
parent bd2494c074
commit 3eb243d5d6
4 changed files with 9 additions and 27 deletions

View File

@ -16,7 +16,7 @@ import { assert } from "@cosmjs/utils";
import { PrivateCosmWasmClient } from "./cosmwasmclient";
import { setupWasmExtension, WasmExtension } from "./lcdapi/wasm";
import { PrivateSigningCosmWasmClient, SigningCosmWasmClient, UploadMeta } from "./signingcosmwasmclient";
import { SigningCosmWasmClient, UploadMeta } from "./signingcosmwasmclient";
import {
alice,
getHackatom,
@ -42,8 +42,7 @@ describe("SigningCosmWasmClient", () => {
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic);
const gasPrice = GasPrice.fromString("3.14utest");
const client = new SigningCosmWasmClient(launchpad.endpoint, alice.address0, wallet, gasPrice);
const openedClient = (client as unknown) as PrivateSigningCosmWasmClient;
expect(openedClient.fees).toEqual({
expect(client.fees).toEqual({
upload: {
amount: [
{
@ -113,8 +112,7 @@ describe("SigningCosmWasmClient", () => {
undefined,
gasLimits,
);
const openedClient = (client as unknown) as PrivateSigningCosmWasmClient;
expect(openedClient.fees).toEqual({
expect(client.fees).toEqual({
upload: {
amount: [
{
@ -185,8 +183,7 @@ describe("SigningCosmWasmClient", () => {
gasPrice,
gasLimits,
);
const openedClient = (client as unknown) as PrivateSigningCosmWasmClient;
expect(openedClient.fees).toEqual({
expect(client.fees).toEqual({
upload: {
amount: [
{

View File

@ -143,11 +143,6 @@ function createBroadcastTxErrorMessage(result: BroadcastTxFailure): string {
return `Error when broadcasting tx ${result.transactionHash} at height ${result.height}. Code: ${result.code}; Raw log: ${result.rawLog}`;
}
/** Use for testing only */
export interface PrivateSigningCosmWasmClient {
readonly fees: CosmWasmFeeTable;
}
export class SigningCosmWasmClient extends CosmWasmClient {
public readonly fees: CosmWasmFeeTable;
public readonly signerAddress: string;

View File

@ -25,7 +25,7 @@ import protobuf from "protobufjs/minimal";
import { MsgStoreCode } from "./codec/cosmwasm/wasm/v1beta1/tx";
import { MsgStoreCodeEncodeObject } from "./encodeobjects";
import { PrivateSigningCosmWasmClient, SigningCosmWasmClient } from "./signingcosmwasmclient";
import { SigningCosmWasmClient } from "./signingcosmwasmclient";
import {
alice,
getHackatom,
@ -56,8 +56,7 @@ describe("SigningCosmWasmClient", () => {
registry.register("/custom.MsgCustom", MsgSend);
const options = { prefix: wasmd.prefix, registry: registry };
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, options);
const openedClient = (client as unknown) as PrivateSigningCosmWasmClient;
expect(openedClient.registry.lookupType("/custom.MsgCustom")).toEqual(MsgSend);
expect(client.registry.lookupType("/custom.MsgCustom")).toEqual(MsgSend);
});
it("can be constructed with custom gas price", async () => {
@ -68,8 +67,7 @@ describe("SigningCosmWasmClient", () => {
gasPrice: GasPrice.fromString("3.14utest"),
};
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, options);
const openedClient = (client as unknown) as PrivateSigningCosmWasmClient;
expect(openedClient.fees).toEqual({
expect(client.fees).toEqual({
upload: {
amount: coins(4710000, "utest"),
gas: "1500000",
@ -123,8 +121,7 @@ describe("SigningCosmWasmClient", () => {
},
};
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, options);
const openedClient = (client as unknown) as PrivateSigningCosmWasmClient;
expect(openedClient.fees).toEqual({
expect(client.fees).toEqual({
upload: {
amount: coins(37500, "ucosm"),
gas: "1500000",
@ -179,8 +176,7 @@ describe("SigningCosmWasmClient", () => {
},
};
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, options);
const openedClient = (client as unknown) as PrivateSigningCosmWasmClient;
expect(openedClient.fees).toEqual({
expect(client.fees).toEqual({
upload: {
amount: coins(4710000, "utest"),
gas: "1500000",

View File

@ -126,12 +126,6 @@ export interface SigningCosmWasmClientOptions {
readonly gasLimits?: Partial<GasLimits<CosmWasmFeeTable>>;
}
/** Use for testing only */
export interface PrivateSigningCosmWasmClient {
readonly fees: CosmWasmFeeTable;
readonly registry: Registry;
}
export class SigningCosmWasmClient extends CosmWasmClient {
public readonly fees: CosmWasmFeeTable;
public readonly registry: Registry;