/** Fadroma. Copyright (C) 2023 Hack.bg. License: GNU AGPLv3 or custom.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see . **/
import { Tx, SecretNetworkClient } from '@hackbg/secretjs-esm';
import type { TxResponse } from '@hackbg/secretjs-esm';
import { ScrtError as Error } from "./scrt-base.dist";
import { ScrtIdentity } from "./scrt-identity.dist";
import type { Message, Address, TxHash, ChainId, CodeId, CodeHash } from '@fadroma/agent';
import { Chain, Token, Deploy } from '@fadroma/agent';
declare const MsgStoreCode: typeof Tx.MsgStoreCode, MsgExecuteContract: typeof Tx.MsgExecuteContract, MsgInstantiateContract: typeof Tx.MsgInstantiateContract;
export type { TxResponse };
/** Represents a Secret Network API endpoint. */
export declare class ScrtConnection extends Chain.Connection {
/** Smallest unit of native token. */
static gasToken: Token.Native;
/** Underlying API client. */
api: SecretNetworkClient;
/** Supports multiple authentication methods. */
identity: ScrtIdentity;
/** Set permissive fees by default. */
fees: {
upload: Token.IFee;
init: Token.IFee;
exec: Token.IFee;
send: Token.IFee;
};
constructor(properties?: Partial);
doGetBlockInfo(): Promise;
doGetHeight(): Promise;
doGetCodes(): Promise>;
doGetCodeId(contract_address: Address): Promise;
doGetContractsByCodeId(code_id: CodeId): Promise>;
doGetCodeHashOfAddress(contract_address: Address): Promise;
doGetCodeHashOfCodeId(code_id: CodeId): Promise;
doGetBalance(denom?: string, address?: string | undefined): Promise;
getLabel(contract_address: Address): Promise;
/** Query a contract.
* @returns the result of the query */
doQuery(contract: {
address: Address;
codeHash: CodeHash;
}, message: Message): Promise;
get account(): ReturnType;
doSend(recipient: Address, amounts: Token.ICoin[], options?: Parameters[2]): Promise;
doSendMany(outputs: [Address, Token.ICoin[]][], options?: unknown): Promise;
sendMany(outputs: never, opts?: any): Promise;
/** Upload a WASM binary. */
doUpload(data: Uint8Array): Promise>;
doInstantiate(codeId: CodeId, options: Parameters[1]): Promise>;
doExecute(contract: {
address: Address;
codeHash: CodeHash;
}, message: Message, options?: Parameters[2] & {
preSimulate?: boolean;
}): Promise;
setMaxGas(): Promise;
fetchLimits(): Promise<{
gas: number;
}>;
getNonce(): Promise<{
accountNumber: number;
sequence: number;
}>;
encrypt(codeHash: CodeHash, msg: Message): Promise;
batch(): Chain.Batch;
}
export declare function decodeError(result: TxResponse): Error & TxResponse;
/** Marks a response field as non-UTF8 to prevent large binary arrays filling the console. */
export declare const nonUtf8: unique symbol;
export declare class ScrtBatch extends Chain.Batch {
/** Messages to encrypt. */
messages: Array | InstanceType | InstanceType>;
/** TODO: Upload in batch. */
upload(code: Parameters["upload"]>[0], options: Parameters["upload"]>[1]): this;
instantiate(code: Parameters["instantiate"]>[0], options: Parameters["instantiate"]>[1]): this;
execute(contract: Parameters["execute"]>[0], message: Parameters["execute"]>[1], options: Parameters["execute"]>[2]): this;
/** Format the messages for API v1 like secretjs and encrypt them. */
private get encryptedMessages();
private encryptUpload;
private encryptInit;
private encryptExec;
simulate(): Promise;
submit({ memo }: {
memo: string;
}): Promise;
/** Format the messages for API v1beta1 like secretcli and generate a multisig-ready
* unsigned transaction batch; don't execute it, but save it in
* `state/$CHAIN_ID/transactions` and output a signing command for it to the console. */
save(name?: string): Promise<{
name: string;
accountNumber: number;
sequence: number;
unsignedTxBody: string;
}>;
private composeUnsignedTx;
}
export interface ScrtBatchResult {
sender?: Address;
tx: TxHash;
type: 'wasm/MsgInstantiateContract' | 'wasm/MsgExecuteContract';
chainId: ChainId;
codeId?: CodeId;
codeHash?: CodeHash;
address?: Address;
label?: Chain.Label;
}
//# sourceMappingURL=scrt-connection.d.ts.map