@archwayhq/arch3-core
Version:
Core library to interact with Archway Network
61 lines (60 loc) • 3.37 kB
TypeScript
import { Coin, Pubkey } from '@cosmjs/amino';
import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate';
import { EncodeObject } from '@cosmjs/proto-signing';
import { HttpEndpoint, HttpBatchClientOptions, CometClient } from '@cosmjs/tendermint-rpc';
import { SimulateResponse } from 'cosmjs-types/cosmos/tx/v1beta1/service';
import { IArchwayQueryClient } from './queryclient';
import { BlockTracking, ContractMetadata, ContractPremium, EstimateTxFees, OutstandingRewards, RewardsPool, RewardsRecord } from './types';
/**
* Extension to the {@link CosmWasmClient } with queries for Archway's modules.
*/
export declare class ArchwayClient extends CosmWasmClient implements IArchwayQueryClient {
private readonly archwayQueryClient;
protected constructor(cometClient: CometClient | undefined);
/**
* Creates an instance by connecting to the given Tendermint/Comet RPC endpoint.
*
* @param endpoint - String URL of the RPC endpoint to connect or an {@link HttpEndpoint} object.
* @returns An {@link ArchwayClient} connected to the endpoint.
*
* @see Use {@link ArchwayClient.create} if you need to support a specific CometBFT version.
*/
static connect(endpoint: string | HttpEndpoint): Promise<ArchwayClient>;
/**
* Creates an instance by connecting to the given Tendermint/CometBFT RPC endpoint using an HttpBatchClient to batch
* multiple requests and reduce queries to the server.
*
* @param endpoint - String URL of the RPC endpoint to connect or an {@link HttpEndpoint} object.
* @param options - Optional configuration to control how the HttpBatchClient will batch requests.
* @returns An {@link ArchwayClient} connected to the endpoint.
*
* @remarks This factory method doesn't support WebSocket endpoints.
*/
static connectWithBatchClient(endpoint: string | HttpEndpoint, options?: Partial<HttpBatchClientOptions>): Promise<ArchwayClient>;
/**
* Creates an instance from a manually created Comet client.
*
* @param cometClient - A Comet client for a given endpoint.
* @returns An {@link ArchwayClient} connected to the endpoint.
*/
static create(cometClient: CometClient): Promise<ArchwayClient>;
getBlockRewardsTracking(): Promise<BlockTracking>;
getContractMetadata(contractAddress: string): Promise<ContractMetadata | undefined>;
getContractPremium(contractAddress: string): Promise<ContractPremium>;
getEstimateTxFees(gasLimit?: number, contractAddress?: string): Promise<EstimateTxFees>;
getOutstandingRewards(rewardsAddress: string): Promise<OutstandingRewards>;
getRewardsPool(): Promise<RewardsPool>;
getAllRewardsRecords(rewardsAddress: string): Promise<readonly RewardsRecord[]>;
simulateTx(messages: readonly EncodeObject[], memo: string | undefined, signer: Pubkey, sequence: number, granter?: string, payer?: string): Promise<SimulateResponse>;
/**
* Queries all balances for all denoms that belong to this address.
*
* Uses the grpc queries (which iterates over the store internally), and we cannot get
* proofs from such a method.
*
* @param address - Address to query balances for.
*
* @returns All balances for all denoms that belong to this address.
*/
getAllBalances(address: string): Promise<readonly Coin[]>;
}