UNPKG

httpay

Version:

HTTPay SDK for interacting with HTTPay smart contracts on Neutron

179 lines 5.88 kB
import * as z from "zod"; import { CosmWasmClient, SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; import { RegistryClient, RegistryQueryClient } from "../Registry/Registry.client"; import * as RegistryTypes from "../Registry/Registry.types"; import { EscrowClient, EscrowQueryClient } from "../Escrow/Escrow.client"; import * as EscrowTypes from "../Escrow/Escrow.types"; export interface HTTPaySDKConfig { rpcEndpoint: string; chainId: string; registryAddress: string; escrowAddress: string; gasPrice: string; gasAdjustment: number; } export interface HTTPayClients { registryQuery: RegistryQueryClient | null; escrowQuery: EscrowQueryClient | null; registry: RegistryClient | null; escrow: EscrowClient | null; cosmWasmClient: CosmWasmClient | null; signingClient: SigningCosmWasmClient | null; } export declare const toolRegistrationSchema: z.ZodObject<{ toolId: z.ZodString; description: z.ZodString; price: z.ZodEffects<z.ZodString, string, string>; endpoint: z.ZodString; denom: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { toolId?: string; denom?: string; description?: string; endpoint?: string; price?: string; }, { toolId?: string; denom?: string; description?: string; endpoint?: string; price?: string; }>; export declare const escrowCreationSchema: z.ZodObject<{ toolId: z.ZodString; maxFee: z.ZodEffects<z.ZodString, string, string>; authToken: z.ZodString; ttl: z.ZodEffects<z.ZodString, string, string>; }, "strip", z.ZodTypeAny, { authToken?: string; maxFee?: string; toolId?: string; ttl?: string; }, { authToken?: string; maxFee?: string; toolId?: string; ttl?: string; }>; export declare const escrowVerificationSchema: z.ZodObject<{ escrowId: z.ZodEffects<z.ZodString, string, string>; authToken: z.ZodString; providerAddr: z.ZodString; }, "strip", z.ZodTypeAny, { escrowId?: string; authToken?: string; providerAddr?: string; }, { escrowId?: string; authToken?: string; providerAddr?: string; }>; export declare const usagePostingSchema: z.ZodObject<{ escrowId: z.ZodEffects<z.ZodString, string, string>; usageFee: z.ZodEffects<z.ZodString, string, string>; }, "strip", z.ZodTypeAny, { escrowId?: string; usageFee?: string; }, { escrowId?: string; usageFee?: string; }>; export type ToolRegistrationForm = z.infer<typeof toolRegistrationSchema>; export type EscrowCreationForm = z.infer<typeof escrowCreationSchema>; export type EscrowVerificationForm = z.infer<typeof escrowVerificationSchema>; export type UsagePostingForm = z.infer<typeof usagePostingSchema>; export type Tool = RegistryTypes.ToolResponse; export type Escrow = EscrowTypes.EscrowResponse; export interface EscrowsFilter { caller?: string; provider?: string; startAfter?: number; limit?: number; } export interface ConnectionState { isConnected: boolean; hasSigningCapabilities: boolean; walletAddress: string | null; currentBlockHeight: number | null; } export interface LockFundsResult { transactionHash: string; escrowId: number; denom?: string; } export interface PostUsageResult { transactionHash: string; claimedAmount: string; } export interface VerificationResult { isValid: boolean; error?: string; escrow?: Escrow; blockHeight?: number; } export interface RegistrationResult { transactionHash: string; toolId: string; } export interface ReleaseResult { transactionHash: string; releasedAmount: string; escrowId: number; } export interface LoadingStates { connecting: boolean; wallet: boolean; tools: boolean; escrows: boolean; registerTool: boolean; updateEndpoint: boolean; lockFunds: boolean; verifyEscrow: boolean; postUsage: boolean; pauseTool: boolean; resumeTool: boolean; updatePrice: boolean; updateDenom: boolean; refundEscrow: boolean; claimFees: boolean; [key: string]: boolean; } export interface HTTPaySDKContextType { config: HTTPaySDKConfig; setConfig: (config: HTTPaySDKConfig) => void; isConnected: boolean; hasSigningCapabilities: boolean; clients: HTTPayClients; walletAddress: string | null; isWalletConnected: boolean; isWalletConnecting: boolean; connectWallet: () => Promise<void>; disconnectWallet: () => Promise<void>; tools: Tool[]; escrows: Escrow[]; hasMoreEscrows: boolean; currentBlockHeight: number | null; loading: LoadingStates; setLoadingState: (key: string, loading: boolean) => void; initializeSDK: () => Promise<void>; initializeWalletSDK: () => Promise<void>; forceReconnectWallet: () => Promise<void>; loadTools: () => Promise<void>; registerTool: (toolData: ToolRegistrationForm) => Promise<void>; updateEndpoint: (toolId: string, endpoint: string) => Promise<void>; updatePrice: (toolId: string, price: string) => Promise<void>; updateDenom: (toolId: string, denom: string) => Promise<void>; pauseTool: (toolId: string) => Promise<void>; resumeTool: (toolId: string) => Promise<void>; loadEscrows: (filter?: EscrowsFilter) => Promise<void>; loadMoreEscrows: () => Promise<void>; resetEscrowsFilter: () => Promise<void>; lockFunds: (escrowData: EscrowCreationForm) => Promise<LockFundsResult | undefined>; verifyEscrow: (verificationData: EscrowVerificationForm) => Promise<VerificationResult>; postUsage: (usageData: UsagePostingForm) => Promise<void>; refundExpired: (escrowId: number) => Promise<void>; claimFees: (denom?: string) => Promise<void>; getCurrentBlockHeight: () => Promise<number>; handleError: (error: Error | unknown, operation: string) => void; } //# sourceMappingURL=index.d.ts.map