cosmwasm: Query contract account by default in Cw3CosmWasmClient

This commit is contained in:
willclarktech 2020-11-24 12:43:42 +00:00
parent db6e585206
commit 62f1410b92
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7
2 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { BroadcastMode, GasLimits, GasPrice, OfflineSigner } from "@cosmjs/launchpad";
import { Account } from "./cosmwasmclient";
import { CosmWasmFeeTable, ExecuteResult, SigningCosmWasmClient } from "./signingcosmwasmclient";
export type Expiration =
@ -75,17 +76,21 @@ export class Cw3CosmWasmClient extends SigningCosmWasmClient {
public constructor(
apiUrl: string,
senderAddress: string,
signerAddress: string,
signer: OfflineSigner,
cw3ContractAddress: string,
gasPrice?: GasPrice,
gasLimits?: Partial<GasLimits<CosmWasmFeeTable>>,
broadcastMode?: BroadcastMode,
) {
super(apiUrl, senderAddress, signer, gasPrice, gasLimits, broadcastMode);
super(apiUrl, signerAddress, signer, gasPrice, gasLimits, broadcastMode);
this.cw3ContractAddress = cw3ContractAddress;
}
public getAccount(address?: string): Promise<Account | undefined> {
return super.getAccount(address || this.cw3ContractAddress);
}
public getThreshold(): Promise<ThresholdResult> {
return this.queryContractSmart(this.cw3ContractAddress, { threshold: {} });
}

View File

@ -1,4 +1,5 @@
import { BroadcastMode, GasLimits, GasPrice, OfflineSigner } from "@cosmjs/launchpad";
import { Account } from "./cosmwasmclient";
import { CosmWasmFeeTable, ExecuteResult, SigningCosmWasmClient } from "./signingcosmwasmclient";
export declare type Expiration =
| {
@ -63,13 +64,14 @@ export declare class Cw3CosmWasmClient extends SigningCosmWasmClient {
private readonly cw3ContractAddress;
constructor(
apiUrl: string,
senderAddress: string,
signerAddress: string,
signer: OfflineSigner,
cw3ContractAddress: string,
gasPrice?: GasPrice,
gasLimits?: Partial<GasLimits<CosmWasmFeeTable>>,
broadcastMode?: BroadcastMode,
);
getAccount(address?: string): Promise<Account | undefined>;
getThreshold(): Promise<ThresholdResult>;
getProposal(proposalId: number): Promise<ProposalResult>;
listProposals({ startAfter, limit }?: StartAfterNumberPaginationOptions): Promise<ProposalsResult>;