From 62f1410b92dfa3470247cec856f48f917b31c8bd Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 24 Nov 2020 12:43:42 +0000 Subject: [PATCH] cosmwasm: Query contract account by default in Cw3CosmWasmClient --- packages/cosmwasm/src/cw3cosmwasmclient.ts | 9 +++++++-- packages/cosmwasm/types/cw3cosmwasmclient.d.ts | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/cosmwasm/src/cw3cosmwasmclient.ts b/packages/cosmwasm/src/cw3cosmwasmclient.ts index bfde5a36..e3f75e13 100644 --- a/packages/cosmwasm/src/cw3cosmwasmclient.ts +++ b/packages/cosmwasm/src/cw3cosmwasmclient.ts @@ -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>, broadcastMode?: BroadcastMode, ) { - super(apiUrl, senderAddress, signer, gasPrice, gasLimits, broadcastMode); + super(apiUrl, signerAddress, signer, gasPrice, gasLimits, broadcastMode); this.cw3ContractAddress = cw3ContractAddress; } + public getAccount(address?: string): Promise { + return super.getAccount(address || this.cw3ContractAddress); + } + public getThreshold(): Promise { return this.queryContractSmart(this.cw3ContractAddress, { threshold: {} }); } diff --git a/packages/cosmwasm/types/cw3cosmwasmclient.d.ts b/packages/cosmwasm/types/cw3cosmwasmclient.d.ts index 529f34f8..11cbdc99 100644 --- a/packages/cosmwasm/types/cw3cosmwasmclient.d.ts +++ b/packages/cosmwasm/types/cw3cosmwasmclient.d.ts @@ -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>, broadcastMode?: BroadcastMode, ); + getAccount(address?: string): Promise; getThreshold(): Promise; getProposal(proposalId: number): Promise; listProposals({ startAfter, limit }?: StartAfterNumberPaginationOptions): Promise;