UNPKG

@cheqd/sdk

Version:

A TypeScript SDK built with CosmJS to interact with the cheqd network ledger

409 lines 22.1 kB
import { MsgAddHostZone, MsgAddHostZoneResponse, MsgFundFeeAbsModuleAccount, MsgFundFeeAbsModuleAccountResponse, MsgRemoveHostZone, MsgRemoveHostZoneResponse, MsgSendQueryIbcDenomTWAP, MsgSendQueryIbcDenomTWAPResponse, MsgSwapCrossChain, MsgSwapCrossChainResponse, MsgUpdateHostZone, MsgUpdateHostZoneResponse, MsgUpdateParams, MsgUpdateParamsResponse, QueryHostChainConfigRequest, QueryHostChainConfigResponse, QueryOsmosisArithmeticTwapRequest, QueryOsmosisArithmeticTwapResponse, QueryFeeabsModuleBalacesRequest, QueryFeeabsModuleBalacesResponse } from '@cheqd/ts-proto/feeabstraction/feeabs/v1beta1/index.js'; import { EncodeObject, GeneratedType } from '@cosmjs/proto-signing'; import { AbstractCheqdSDKModule, MinimalImportableCheqdSDKModule } from './_.js'; import { DeliverTxResponse, QueryClient } from '@cosmjs/stargate'; import { DidStdFee, IContext, QueryExtensionSetup } from '../types.js'; import { CheqdQuerier } from '../querier.js'; import { CheqdSigningStargateClient } from '../signer.js'; import { Coin } from 'cosmjs-types/cosmos/base/v1beta1/coin.js'; /** Default extension key for fee abstraction-related query operations */ export declare const defaultFeeabstractionExtensionKey: "feeabs"; /** * Protobuf message type literals for fee abstraction operations. * Used for consistent message type identification across the module. */ export declare const protobufLiterals: { /** Add host zone message type */ readonly MsgAddHostZone: "MsgAddHostZone"; /** Add host zone response message type */ readonly MsgAddHostZoneResponse: "MsgAddHostZoneResponse"; /** Fund fee abstraction module account message type */ readonly MsgFundFeeAbsModuleAccount: "MsgFundFeeAbsModuleAccount"; /** Fund fee abstraction module account response message type */ readonly MsgFundFeeAbsModuleAccountResponse: "MsgFundFeeAbsModuleAccountResponse"; /** Remove host zone message type */ readonly MsgRemoveHostZone: "MsgRemoveHostZone"; /** Remove host zone response message type */ readonly MsgRemoveHostZoneResponse: "MsgRemoveHostZoneResponse"; /** Send query IBC denomination TWAP message type */ readonly MsgSendQueryIbcDenomTWAP: "MsgSendQueryIbcDenomTWAP"; /** Send query IBC denomination TWAP response message type */ readonly MsgSendQueryIbcDenomTWAPResponse: "MsgSendQueryIbcDenomTWAPResponse"; /** Swap cross-chain message type */ readonly MsgSwapCrossChain: "MsgSwapCrossChain"; /** Swap cross-chain response message type */ readonly MsgSwapCrossChainResponse: "MsgSwapCrossChainResponse"; /** Update host zone message type */ readonly MsgUpdateHostZone: "MsgUpdateHostZone"; /** Update host zone response message type */ readonly MsgUpdateHostZoneResponse: "MsgUpdateHostZoneResponse"; /** Update parameters message type */ readonly MsgUpdateParams: "MsgUpdateParams"; /** Update parameters response message type */ readonly MsgUpdateParamsResponse: "MsgUpdateParamsResponse"; }; /** Type URL for MsgAddHostZone messages */ export declare const typeUrlMsgAddHostZone: "/feeabstraction.feeabs.v1beta1.MsgAddHostZone"; /** Type URL for MsgAddHostZoneResponse messages */ export declare const typeUrlMsgAddHostZoneResponse: "/feeabstraction.feeabs.v1beta1.MsgAddHostZoneResponse"; /** Type URL for MsgFundFeeAbsModuleAccount messages */ export declare const typeUrlMsgFundFeeAbsModuleAccount: "/feeabstraction.feeabs.v1beta1.MsgFundFeeAbsModuleAccount"; /** Type URL for MsgFundFeeAbsModuleAccountResponse messages */ export declare const typeUrlMsgFundFeeAbsModuleAccountResponse: "/feeabstraction.feeabs.v1beta1.MsgFundFeeAbsModuleAccountResponse"; /** Type URL for MsgRemoveHostZone messages */ export declare const typeUrlMsgRemoveHostZone: "/feeabstraction.feeabs.v1beta1.MsgRemoveHostZone"; /** Type URL for MsgRemoveHostZoneResponse messages */ export declare const typeUrlMsgRemoveHostZoneResponse: "/feeabstraction.feeabs.v1beta1.MsgRemoveHostZoneResponse"; /** Type URL for MsgSendQueryIbcDenomTWAP messages */ export declare const typeUrlMsgSendQueryIbcDenomTWAP: "/feeabstraction.feeabs.v1beta1.MsgSendQueryIbcDenomTWAP"; /** Type URL for MsgSendQueryIbcDenomTWAPResponse messages */ export declare const typeUrlMsgSendQueryIbcDenomTWAPResponse: "/feeabstraction.feeabs.v1beta1.MsgSendQueryIbcDenomTWAPResponse"; /** Type URL for MsgSwapCrossChain messages */ export declare const typeUrlMsgSwapCrossChain: "/feeabstraction.feeabs.v1beta1.MsgSwapCrossChain"; /** Type URL for MsgSwapCrossChainResponse messages */ export declare const typeUrlMsgSwapCrossChainResponse: "/feeabstraction.feeabs.v1beta1.MsgSwapCrossChainResponse"; /** Type URL for MsgUpdateHostZone messages */ export declare const typeUrlMsgUpdateHostZone: "/feeabstraction.feeabs.v1beta1.MsgUpdateHostZone"; /** Type URL for MsgUpdateHostZoneResponse messages */ export declare const typeUrlMsgUpdateHostZoneResponse: "/feeabstraction.feeabs.v1beta1.MsgUpdateHostZoneResponse"; /** Type URL for MsgUpdateParams messages */ export declare const typeUrlMsgUpdateParams: "/feeabstraction.feeabs.v1beta1.MsgUpdateParams"; /** Type URL for MsgUpdateParamsResponse messages */ export declare const typeUrlMsgUpdateParamsResponse: "/feeabstraction.feeabs.v1beta1.MsgUpdateParamsResponse"; /** * Encode object interface for MsgAddHostZone messages. * Used for type-safe message encoding in fee abstraction transactions. */ export interface MsgAddHostZoneEncodeObject extends EncodeObject { readonly typeUrl: typeof typeUrlMsgAddHostZone; readonly value: Partial<MsgAddHostZone>; } /** * Type guard function to check if an object is a MsgAddHostZoneEncodeObject. * * @param obj - EncodeObject to check * @returns True if the object is a MsgAddHostZoneEncodeObject */ export declare function isMsgAddHostZoneEncodeObject(obj: EncodeObject): obj is MsgAddHostZoneEncodeObject; export interface MsgAddHostZoneResponseEncodeObject extends EncodeObject { readonly typeUrl: typeof typeUrlMsgAddHostZoneResponse; readonly value: Partial<MsgAddHostZoneResponse>; } export declare function isMsgAddHostZoneResponseEncodeObject(obj: EncodeObject): obj is MsgAddHostZoneResponseEncodeObject; export interface MsgFundFeeAbsModuleAccountEncodeObject extends EncodeObject { readonly typeUrl: typeof typeUrlMsgFundFeeAbsModuleAccount; readonly value: Partial<MsgFundFeeAbsModuleAccount>; } export declare function isMsgFundFeeAbsModuleAccountEncodeObject(obj: EncodeObject): obj is MsgFundFeeAbsModuleAccountEncodeObject; /** * Encode object interface for MsgFundFeeAbsModuleAccountResponse messages. * Used for type-safe response message handling in fee abstraction module funding operations. */ export interface MsgFundFeeAbsModuleAccountResponseEncodeObject extends EncodeObject { readonly typeUrl: typeof typeUrlMsgFundFeeAbsModuleAccountResponse; readonly value: Partial<MsgFundFeeAbsModuleAccountResponse>; } /** * Type guard function to check if an object is a MsgFundFeeAbsModuleAccountResponseEncodeObject. * * @param obj - EncodeObject to check * @returns True if the object is a MsgFundFeeAbsModuleAccountResponseEncodeObject */ export declare function isMsgFundFeeAbsModuleAccountResponseEncodeObject(obj: EncodeObject): obj is MsgFundFeeAbsModuleAccountResponseEncodeObject; /** * Encode object interface for MsgRemoveHostZone messages. * Used for type-safe message encoding in host zone removal transactions. */ export interface MsgRemoveHostZoneEncodeObject extends EncodeObject { readonly typeUrl: typeof typeUrlMsgRemoveHostZone; readonly value: Partial<MsgRemoveHostZone>; } /** * Type guard function to check if an object is a MsgRemoveHostZoneEncodeObject. * * @param obj - EncodeObject to check * @returns True if the object is a MsgRemoveHostZoneEncodeObject */ export declare function isMsgRemoveHostZoneEncodeObject(obj: EncodeObject): obj is MsgRemoveHostZoneEncodeObject; /** * Encode object interface for MsgRemoveHostZoneResponse messages. * Used for type-safe response message handling in host zone removal operations. */ export interface MsgRemoveHostZoneResponseEncodeObject extends EncodeObject { readonly typeUrl: typeof typeUrlMsgRemoveHostZoneResponse; readonly value: Partial<MsgRemoveHostZoneResponse>; } /** * Type guard function to check if an object is a MsgRemoveHostZoneResponseEncodeObject. * * @param obj - EncodeObject to check * @returns True if the object is a MsgRemoveHostZoneResponseEncodeObject */ export declare function isMsgRemoveHostZoneResponseEncodeObject(obj: EncodeObject): obj is MsgRemoveHostZoneResponseEncodeObject; /** * Encode object interface for MsgSendQueryIbcDenomTWAP messages. * Used for type-safe message encoding in IBC denomination TWAP query transactions. */ export interface MsgSendQueryIbcDenomTWAPEncodeObject extends EncodeObject { readonly typeUrl: typeof typeUrlMsgSendQueryIbcDenomTWAP; readonly value: Partial<MsgSendQueryIbcDenomTWAP>; } /** * Type guard function to check if an object is a MsgSendQueryIbcDenomTWAPEncodeObject. * * @param obj - EncodeObject to check * @returns True if the object is a MsgSendQueryIbcDenomTWAPEncodeObject */ export declare function isMsgSendQueryIbcDenomTWAPEncodeObject(obj: EncodeObject): obj is MsgSendQueryIbcDenomTWAPEncodeObject; /** * Encode object interface for MsgSendQueryIbcDenomTWAPResponse messages. * Used for type-safe response message handling in IBC denomination TWAP query operations. */ export interface MsgSendQueryIbcDenomTWAPResponseEncodeObject extends EncodeObject { readonly typeUrl: typeof typeUrlMsgSendQueryIbcDenomTWAPResponse; readonly value: Partial<MsgSendQueryIbcDenomTWAPResponse>; } /** * Type guard function to check if an object is a MsgSendQueryIbcDenomTWAPResponseEncodeObject. * * @param obj - EncodeObject to check * @returns True if the object is a MsgSendQueryIbcDenomTWAPResponseEncodeObject */ export declare function isMsgSendQueryIbcDenomTWAPResponseEncodeObject(obj: EncodeObject): obj is MsgSendQueryIbcDenomTWAPResponseEncodeObject; /** * Encode object interface for MsgSwapCrossChain messages. * Used for type-safe message encoding in cross-chain swap transactions. */ export interface MsgSwapCrossChainEncodeObject extends EncodeObject { readonly typeUrl: typeof typeUrlMsgSwapCrossChain; readonly value: Partial<MsgSwapCrossChain>; } /** * Type guard function to check if an object is a MsgSwapCrossChainEncodeObject. * * @param obj - EncodeObject to check * @returns True if the object is a MsgSwapCrossChainEncodeObject */ export declare function isMsgSwapCrossChainEncodeObject(obj: EncodeObject): obj is MsgSwapCrossChainEncodeObject; /** * Encode object interface for MsgSwapCrossChainResponse messages. * Used for type-safe response message handling in cross-chain swap operations. */ export interface MsgSwapCrossChainResponseEncodeObject extends EncodeObject { readonly typeUrl: typeof typeUrlMsgSwapCrossChainResponse; readonly value: Partial<MsgSwapCrossChainResponse>; } /** * Type guard function to check if an object is a MsgSwapCrossChainResponseEncodeObject. * * @param obj - EncodeObject to check * @returns True if the object is a MsgSwapCrossChainResponseEncodeObject */ export declare function isMsgSwapCrossChainResponseEncodeObject(obj: EncodeObject): obj is MsgSwapCrossChainResponseEncodeObject; /** * Encode object interface for MsgUpdateHostZone messages. * Used for type-safe message encoding in host zone update transactions. */ export interface MsgUpdateHostZoneEncodeObject extends EncodeObject { readonly typeUrl: typeof typeUrlMsgUpdateHostZone; readonly value: Partial<MsgUpdateHostZone>; } /** * Type guard function to check if an object is a MsgUpdateHostZoneEncodeObject. * * @param obj - EncodeObject to check * @returns True if the object is a MsgUpdateHostZoneEncodeObject */ export declare function isMsgUpdateHostZoneEncodeObject(obj: EncodeObject): obj is MsgUpdateHostZoneEncodeObject; /** * Encode object interface for MsgUpdateHostZoneResponse messages. * Used for type-safe response message handling in host zone update operations. */ export interface MsgUpdateHostZoneResponseEncodeObject extends EncodeObject { readonly typeUrl: typeof typeUrlMsgUpdateHostZoneResponse; readonly value: Partial<MsgUpdateHostZoneResponse>; } /** * Type guard function to check if an object is a MsgUpdateHostZoneResponseEncodeObject. * * @param obj - EncodeObject to check * @returns True if the object is a MsgUpdateHostZoneResponseEncodeObject */ export declare function isMsgUpdateHostZoneResponseEncodeObject(obj: EncodeObject): obj is MsgUpdateHostZoneResponseEncodeObject; /** * Encode object interface for MsgUpdateParams messages. * Used for type-safe message encoding in parameter update transactions. */ export interface MsgUpdateParamsEncodeObject extends EncodeObject { readonly typeUrl: typeof typeUrlMsgUpdateParams; readonly value: Partial<MsgUpdateParams>; } /** * Type guard function to check if an object is a MsgUpdateParamsEncodeObject. * * @param obj - EncodeObject to check * @returns True if the object is a MsgUpdateParamsEncodeObject */ export declare function isMsgUpdateParamsEncodeObject(obj: EncodeObject): obj is MsgUpdateParamsEncodeObject; /** * Encode object interface for MsgUpdateParamsResponse messages. * Used for type-safe response message handling in parameter update operations. */ export interface MsgUpdateParamsResponseEncodeObject extends EncodeObject { readonly typeUrl: typeof typeUrlMsgUpdateParamsResponse; readonly value: Partial<MsgUpdateParamsResponse>; } /** * Type guard function to check if an object is a MsgUpdateParamsResponseEncodeObject. * * @param obj - EncodeObject to check * @returns True if the object is a MsgUpdateParamsResponseEncodeObject */ export declare function isMsgUpdateParamsResponseEncodeObject(obj: EncodeObject): obj is MsgUpdateParamsResponseEncodeObject; /** Minimal importable version of the fee abstraction module for clean external interfaces */ export type MinimalImportableFeeabstractionModule = MinimalImportableCheqdSDKModule<FeeabstractionModule>; /** * Fee abstraction extension interface for querier functionality. * Provides methods for querying fee abstraction-related data. */ export type FeeabstractionExtension = { readonly [defaultFeeabstractionExtensionKey]: { /** Query host chain configuration */ readonly hostChainConfig: (request: QueryHostChainConfigRequest) => Promise<QueryHostChainConfigResponse>; /** Query Osmosis arithmetic TWAP data */ readonly osmosisArithmeticTwap: (request: QueryOsmosisArithmeticTwapRequest) => Promise<QueryOsmosisArithmeticTwapResponse>; /** Query fee abstraction module account balances */ readonly feeabsModuleBalances: (request: QueryFeeabsModuleBalacesRequest) => Promise<QueryFeeabsModuleBalacesResponse>; }; }; /** * Sets up the fee abstraction extension for the querier client. * Creates and configures the fee abstraction-specific query methods. * * @param base - Base QueryClient to extend * @returns Configured fee abstraction extension with query methods */ export declare const setupFeeabstractionExtension: (base: QueryClient) => FeeabstractionExtension; /** * Fee Abstraction Module class providing comprehensive fee abstraction functionality. * Handles host zone management, cross-chain swaps, and fee abstraction operations on the Cheqd blockchain. */ export declare class FeeabstractionModule extends AbstractCheqdSDKModule { static readonly registryTypes: Iterable<[string, GeneratedType]>; /** Querier extension setup function for fee abstraction operations */ static readonly querierExtensionSetup: QueryExtensionSetup<FeeabstractionExtension>; /** Querier instance with fee abstraction extension capabilities */ querier: CheqdQuerier & FeeabstractionExtension; /** * Constructs a new fee abstraction module instance. * * @param signer - Signing client for blockchain transactions * @param querier - Querier client with fee abstraction extension for data retrieval */ constructor(signer: CheqdSigningStargateClient, querier: CheqdQuerier & FeeabstractionExtension); /** * Gets the registry types for fee abstraction message encoding/decoding. * * @returns Iterable of [typeUrl, GeneratedType] pairs for the registry */ getRegistryTypes(): Iterable<[string, GeneratedType]>; /** * Gets the querier extension setup for fee abstraction operations. * * @returns Query extension setup function for fee abstraction functionality */ getQuerierExtensionSetup(): QueryExtensionSetup<FeeabstractionExtension>; /** * Creates a governance proposal to add a new host zone for fee abstraction. * Submits the proposal through the governance module for community voting. * * @param data - Host zone data to add * @param title - Proposal title * @param deposit - Initial deposit for the proposal * @param proposer - Address of the proposal submitter * @param fee - Transaction fee configuration * @param memo - Optional transaction memo * @param context - Optional SDK context for accessing clients * @returns Promise resolving to the transaction response */ addHostZoneProposal(data: MsgAddHostZone, title: string, deposit: Coin[], proposer: string, fee: DidStdFee, memo?: string, context?: IContext): Promise<DeliverTxResponse>; /** * Funds the fee abstraction module account with tokens. * Allows users to provide liquidity for fee abstraction functionality. * * @param sender - Address of the account sending funds * @param amount - Array of coins to send to the module account * @param fee - Transaction fee configuration * @param memo - Optional transaction memo * @param context - Optional SDK context for accessing clients * @returns Promise resolving to the transaction response */ fundFeeAbsModuleAccount(sender: string, amount: Coin[], fee: DidStdFee, memo?: string, context?: IContext): Promise<MsgFundFeeAbsModuleAccountResponse>; /** * Creates a governance proposal to remove an existing host zone from fee abstraction. * Submits the proposal through the governance module for community voting. * * @param data - Host zone data to remove * @param title - Proposal title * @param deposit - Initial deposit for the proposal * @param proposer - Address of the proposal submitter * @param fee - Transaction fee configuration * @param memo - Optional transaction memo * @param context - Optional SDK context for accessing clients * @returns Promise resolving to the transaction response */ removeHostZoneProposal(data: MsgRemoveHostZone, title: string, deposit: Coin[], proposer: string, fee: DidStdFee, memo?: string, context?: IContext): Promise<DeliverTxResponse>; /** * Sends a query for IBC denomination Time-Weighted Average Price (TWAP) data. * Initiates a cross-chain query to retrieve pricing information for fee calculation. * * @param sender - Address of the account sending the query * @param data - TWAP query data containing denomination and parameters * @param fee - Transaction fee configuration * @param memo - Optional transaction memo * @param context - Optional SDK context for accessing clients * @returns Promise resolving to the TWAP query response */ sendQueryIbcDenomTWAP(sender: string, data: MsgSendQueryIbcDenomTWAP, fee: DidStdFee, memo?: string, context?: IContext): Promise<MsgSendQueryIbcDenomTWAPResponse>; /** * Performs a cross-chain token swap using fee abstraction. * Enables users to swap IBC tokens across different chains. * * @param sender - Address of the account initiating the swap * @param ibcDenom - IBC denomination to swap * @param fee - Transaction fee configuration * @param memo - Optional transaction memo * @param context - Optional SDK context for accessing clients * @returns Promise resolving to the swap response */ swapCrossChain(sender: string, ibcDenom: string, fee: DidStdFee, memo?: string, context?: IContext): Promise<MsgSwapCrossChainResponse>; /** * Creates a governance proposal to update an existing host zone configuration. * Submits the proposal through the governance module for community voting. * * @param data - Updated host zone configuration data * @param title - Proposal title * @param deposit - Initial deposit for the proposal * @param proposer - Address of the proposal submitter * @param fee - Transaction fee configuration * @param memo - Optional transaction memo * @param context - Optional SDK context for accessing clients * @returns Promise resolving to the transaction response */ updateHostZoneProposal(data: MsgUpdateHostZone, title: string, deposit: Coin[], proposer: string, fee: DidStdFee, memo?: string, context?: IContext): Promise<DeliverTxResponse>; /** * Creates a governance proposal to update fee abstraction module parameters. * Submits the proposal through the governance module for community voting. * * @param data - Updated module parameters * @param title - Proposal title * @param deposit - Initial deposit for the proposal * @param proposer - Address of the proposal submitter * @param fee - Transaction fee configuration * @param memo - Optional transaction memo * @param context - Optional SDK context for accessing clients * @returns Promise resolving to the transaction response */ updateParamsProposal(data: MsgUpdateParams, title: string, deposit: Coin[], proposer: string, fee: DidStdFee, memo?: string, context?: IContext): Promise<DeliverTxResponse>; } //# sourceMappingURL=feeabstraction.d.ts.map