httpay
Version:
HTTPay SDK for interacting with HTTPay smart contracts on Neutron
64 lines • 2.37 kB
TypeScript
import { CosmWasmClient, SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate";
import { RegistryClient, RegistryQueryClient } from "../Registry/Registry.client";
import { EscrowClient, EscrowQueryClient } from "../Escrow/Escrow.client";
import type { HTTPaySDKConfig, HTTPayClients } from "../types";
/**
* Create read-only (query) clients for HTTPay contracts
*/
export declare function createQueryClients(config: HTTPaySDKConfig): Promise<{
cosmWasmClient: CosmWasmClient;
registryQuery: RegistryQueryClient;
escrowQuery: EscrowQueryClient;
}>;
/**
* Create signing clients for HTTPay contracts
*/
export declare function createSigningClients(signingClient: SigningCosmWasmClient, walletAddress: string, config: HTTPaySDKConfig): {
registry: RegistryClient;
escrow: EscrowClient;
};
/**
* Create empty clients object
*/
export declare function createEmptyClients(): HTTPayClients;
/**
* Handle and normalize errors from SDK operations
*/
export declare function handleSDKError(error: unknown, operation: string): Error;
/**
* Extract escrow ID from transaction attributes
*/
export declare function extractEscrowIdFromTx(txHash: string, events: any[]): number | null;
/**
* Convert base64 string to regular string
*/
export declare function fromBase64(base64String: string): string;
/**
* Convert string to base64
*/
export declare function toBase64(input: string): string;
/**
* Validate wallet address format
*/
export declare function isValidAddress(address: string, prefix?: string): boolean;
/**
* Format token amount for display
*/
export declare function formatTokenAmount(amount: string, decimals?: number): string;
/**
* Parse token amount from user input to smallest unit
*/
export declare function parseTokenAmount(amount: string, decimals?: number): string;
/**
* Get short address for display (e.g., "neutron1abc...xyz")
*/
export declare function getShortAddress(address: string, startChars?: number, endChars?: number): string;
/**
* Calculate blocks until expiration
*/
export declare function getBlocksUntilExpiration(expirationBlock: number, currentBlock: number): number;
/**
* Estimate time until expiration (assuming ~6 second block time)
*/
export declare function estimateTimeUntilExpiration(expirationBlock: number, currentBlock: number): string;
//# sourceMappingURL=client-utils.d.ts.map