import { Logged } from "./core.dist"; import * as Code from "./program.dist"; import * as Deploy from "./deploy.dist"; import * as Token from "./token.dist"; import * as Store from "./store.dist"; export declare const _$_HACK_$_: { CompiledCode: typeof Code.CompiledCode; }; export type ChainId = string; /** An address on a chain. */ export type Address = string; /** A contract's full unique on-chain label. */ export type Label = string; /** A transaction message that can be sent to a contract. */ export type Message = string | Record; /** A transaction hash, uniquely identifying an executed transaction on a chain. */ export type TxHash = string; export declare class Identity extends Logged { /** Display name. */ name?: Address; /** Unique identifier. */ address?: Address; constructor(properties?: Partial); sign(doc: any): unknown; } export declare abstract class Endpoint extends Logged { /** Chain ID. */ chainId?: ChainId; /** Setting this to false stops retries. */ alive: boolean; /** Connection URL. */ url?: string; /** Platform SDK. */ api?: unknown; constructor(properties?: Partial); get [Symbol.toStringTag](): string; } export declare abstract class Connection extends Endpoint { /** Native token of chain. */ static gasToken: Token.Native; /** Native token of chain. */ static gas(amount: number | Token.Uint128): Token.Amount; /** Signer identity. */ identity?: Identity; /** Default transaction fees. */ fees?: { send?: Token.IFee; upload?: Token.IFee; init?: Token.IFee; exec?: Token.IFee; }; constructor(properties?: Partial); get [Symbol.toStringTag](): string; get address(): Address | undefined; get defaultDenom(): string; get height(): Promise; /** Time to ping for next block. */ blockInterval: number; /** Wait for the block height to increment. */ get nextBlock(): Promise; abstract doGetHeight(): Promise; abstract doGetBlockInfo(): Promise; /** Get the code id of a given address. */ getCodeId(contract: Address | { address: Address; }): Promise; abstract doGetCodeId(contract: Address): Promise; /** Get the code hash of a given code id. */ getCodeHashOfCodeId(contract: Deploy.CodeId | { codeId: Deploy.CodeId; }): Promise; abstract doGetCodeHashOfCodeId(codeId: Deploy.CodeId): Promise; /** Get the code hash of a given address. */ getCodeHashOfAddress(contract: Address | { address: Address; }): Promise; abstract doGetCodeHashOfAddress(contract: Address): Promise; /** Get a client handle for a specific smart contract, authenticated as as this agent. */ getContract(options: Address | { address: Address; }): Contract; getCodes(): Promise>; abstract doGetCodes(): Promise>; /** Get client handles for all contracts that match a code ID */ getContractsByCodeId(id: Deploy.CodeId): Promise>; getContractsByCodeId(id: Deploy.CodeId, $C: C): Promise>>; abstract doGetContractsByCodeId(id: Deploy.CodeId): Promise>; /** Get client handles for all contracts that match multiple code IDs */ getContractsByCodeIds(ids: Iterable): Promise>>; getContractsByCodeIds(ids: Iterable, $C?: C): Promise>>>; getContractsByCodeIds(ids: Record): Promise>>>; get balance(): Promise; /** Get the balance in a native token of a given address, * either in this connection's gas token, * or in another given token. */ getBalanceOf(address: Address | { address: Address; }, token?: string): Promise; /** Get the balance in a given native token, of * either this connection's identity's address, * or of another given address. */ getBalanceIn(token: string, address?: Address | { address: Address; }): Promise; abstract doGetBalance(token?: string, address?: string): Promise; /** Query a contract. */ query(contract: Address | { address: Address; }, message: Message): Promise; abstract doQuery(contract: { address: Address; }, message: Message): Promise; /** Send native tokens to 1 recipient. */ send(recipient: Address | { address?: Address; }, amounts: (Token.Amount | Token.ICoin)[], options?: { sendFee?: Token.IFee; sendMemo?: string; }): Promise; abstract doSend(recipient: Address, amounts: Token.ICoin[], options?: Parameters[2]): Promise; abstract doSendMany(outputs: [Address, Token.ICoin[]][], options?: unknown): Promise; /** Upload a contract's code, generating a new code id/hash pair. */ upload(code: string | URL | Uint8Array | Partial, options?: { reupload?: boolean; uploadStore?: Store.UploadStore; uploadFee?: Token.ICoin[] | 'auto'; uploadMemo?: string; }): Promise; abstract doUpload(data: Uint8Array, options: Parameters[1]): Promise>; /** Instantiate a new program from a code id, label and init message. * @example * await agent.instantiate(template.define({ label, initMsg }) * @returns * Deploy.ContractInstance with no `address` populated yet. * This will be populated after executing the batch. */ instantiate(contract: Deploy.CodeId | Partial, options: Partial): Promise; abstract doInstantiate(codeId: Deploy.CodeId, options: Partial): Promise>; /** Call a given program's transaction method. */ execute(contract: Address | Partial, message: Message, options?: { execFee?: Token.IFee; execSend?: Token.ICoin[]; execMemo?: string; }): Promise; abstract doExecute(contract: { address: Address; }, message: Message, options: Parameters[2]): Promise; /** Construct a transaction batch. */ batch(): Batch; } /** Contract: interface to the API of a particular contract instance. * Has an `address` on a specific `chain`, usually also an `agent`. * Subclass this to add the contract's methods. */ export declare class Contract extends Logged { instance?: { address?: Address; }; connection?: Connection; constructor(properties: Address | Partial); /** Execute a query on the specified instance as the specified Connection. */ query(message: Message): Promise; /** Execute a transaction on the specified instance as the specified Connection. */ execute(message: Message, options?: Parameters[2]): Promise; } export declare abstract class Backend extends Logged { /** The chain ID that will be passed to the devnet node. */ chainId?: ChainId; /** Denomination of base gas token for this chain. */ gasToken?: Token.Native; constructor(properties?: Partial); abstract connect(parameter?: string | Partial): Promise; abstract getIdentity(name: string): Promise<{ address?: Address; mnemonic?: string; }>; } /** Builder object for batched transactions. */ export declare class Batch extends Logged { connection?: C; constructor(properties?: Partial>); /** Add an upload message to the batch. */ upload(...args: Parameters): this; /** Add an instantiate message to the batch. */ instantiate(...args: Parameters): this; /** Add an execute message to the batch. */ execute(...args: Parameters): this; /** Submit the batch. */ submit(...args: unknown[]): Promise; } //# sourceMappingURL=chain.d.ts.map