Cosmos.ts
This module handles Cosmos related functionality.
Added in v2.0.0
Signature
export declare class ChannelDestination
Added in v2.0.0
Source: src/Cosmos.ts:92
Signature
export declare class ChannelSource
Added in v2.0.0
Source: src/Cosmos.ts:106
A neutral CosmWasmClient that can be used for general-purpose operations that don’t specifically target source or destination chains
Signature
export declare class Client
Added in v2.0.0
Source: src/Cosmos.ts:149
Context for providing a CosmWasmClient for the destination chain
Signature
export declare class ClientDestination
Added in v2.0.0
Source: src/Cosmos.ts:135
Context for providing a CosmWasmClient for the source chain
Signature
export declare class ClientSource
Added in v2.0.0
Source: src/Cosmos.ts:122
Signature
export declare class DestinationConfig
Added in v2.0.0
Source: src/Cosmos.ts:173
Context for providing a SigningCosmWasmClient
Signature
export declare class SigningClient
Added in v2.0.0
Source: src/Cosmos.ts:162
Error type for CosmWasm client failures
Signature
export declare class ClientError
Added in v2.0.0
Source: src/Cosmos.ts:184
Error type for CosmWasm contract execution failures
Signature
export declare class ExecuteContractError
Added in v2.0.0
Source: src/Cosmos.ts:206
Error when fetching a balance at latest height
Signature
export declare class GetBalanceError
Added in v2.0.0
Source: src/Cosmos.ts:229
Error when fetching the latest block height
Signature
export declare class GetHeightError
Added in v2.0.0
Source: src/Cosmos.ts:219
Error type for HttpRequest execution failures
Signature
export declare class HttpRequestFailed
Added in v2.0.0
Source: src/Cosmos.ts:356
Error type for CosmWasm contract query failures
Signature
export declare class QueryContractError
Added in v2.0.0
Source: src/Cosmos.ts:194
Added in v2.0.0
Signature
export interface Channel { readonly ucs03address: string readonly channelId: number}
Source: src/Cosmos.ts:44
Added in v2.0.0
Signature
export interface PublicClient { client: CosmWasmClient}
Source: src/Cosmos.ts:28
Added in v2.0.0
Signature
export interface SigningClient { client: SigningCosmWasmClient}
Source: src/Cosmos.ts:36
Added in v2.0.0
Interface for CW20 token balance response
Signature
export interface Cw20AllowanceResponse { allowance: number expiration: any // XXX}
Source: src/Cosmos.ts:474
Added in v2.0.0
Interface for CW20 token balance response
Signature
export interface Cw20BalanceResponse { balance: string}
Source: src/Cosmos.ts:464
Added in v2.0.0
Interface for CW20 token metadata
Signature
export interface Cw20TokenInfo { name: string symbol: string decimals: number total_supply: string}
Source: src/Cosmos.ts:451
Added in v2.0.0
Signature
export declare const channelBalance: ( path: bigint, token: string) => Effect.Effect<unknown, TimeoutException | QueryContractError, ChannelDestination | Client>
Source: src/Cosmos.ts:660
Added in v2.0.0
Signature
export declare const channelBalanceAtHeight: ( rest: string, path: bigint, token: string, height: number) => Effect.Effect<string, NoSuchElementException | QueryContractError, ChannelDestination>
Source: src/Cosmos.ts:678
Added in v2.0.0
A type-safe wrapper around CosmWasm’s executeContract that handles error cases and returns an Effect with proper type inference.
Signature
export declare const executeContract: ( senderAddress: string, contractAddress: string, msg: Record<string, unknown>, funds?: ReadonlyArray<{ denom: string; amount: string }>) => Effect.Effect<ExecuteResult, ExecuteContractError, SigningClient>
Source: src/Cosmos.ts:279
Added in v2.0.0
Fetch an account’s balance for a denom at a specific block height.
Signature
export declare function getBalanceAtHeight(restEndpoint: string, address: string, denom: string, height: number)
Source: src/Cosmos.ts:407
Added in v2.0.0
Wrap CosmWasmClient.getBalance() in an Effect
Signature
export declare const getBalanceNow: ( address: `${string}1${string}`, denom: string) => Effect.Effect.AsEffect<Effect.Effect<Coin, GetBalanceError, Client>>
Source: src/Cosmos.ts:330
Added in v2.0.0
Wrap CosmWasmClient.getHeight() in an Effect
Signature
export declare function getChainHeight(client: CosmWasmClient)
Source: src/Cosmos.ts:312
Added in v2.0.0
Checks whether a denom is a native token or CW20.
Signature
export declare const isDenomNative: (denom: string) => Effect.Effect<boolean, never, Client>
Source: src/Cosmos.ts:645
Added in v2.0.0
Signature
export declare const predictQuoteToken: ( baseToken: string) => Effect.Effect<`0x${string}`, TimeoutException | QueryContractError, ChannelDestination | Client>
Source: src/Cosmos.ts:704
Added in v2.0.0
A type-safe wrapper around CosmWasm’s queryContract that handles error cases and returns an Effect with proper type inference.
Signature
export declare const queryContract: <T = unknown>( contractAddress: string, queryMsg: Record<string, unknown>) => Effect.Effect<T, TimeoutException | QueryContractError, Client>
Source: src/Cosmos.ts:245
Added in v2.0.0
Query a contract at an explicit block height.
Signature
export declare function queryContractSmartAtHeight<T = unknown>( restEndpoint: string, contractAddress: string, queryMsg: Record<string, unknown>, height: number)
Source: src/Cosmos.ts:367
Added in v2.0.0
Read the allowance of a CW20 token for a specific addresses
Signature
export declare const readCw20Allowance: ( contract: AddressCosmosDisplay, owner: AddressCosmosDisplay, spender: AddressCosmosDisplay) => Effect.Effect<number, TimeoutException | QueryContractError, Client>
Source: src/Cosmos.ts:596
Added in v2.0.0
Read the balance of a CW20 token for a specific address
Signature
export declare const readCw20Balance: ( contractAddress: string, address: string) => Effect.Effect<string, TimeoutException | QueryContractError, Client>
Source: src/Cosmos.ts:576
Added in v2.0.0
Read the balance of a CW20 token for a specific address
Signature
export declare const readCw20BalanceAtHeight: ( rest: string, contractAddress: string, address: string, height: number) => Effect.Effect<string, QueryContractError, never>
Source: src/Cosmos.ts:517
Added in v2.0.0
Read CW20 token metadata (name, symbol, decimals, total_supply)
Signature
export declare const readCw20TokenInfo: ( contractAddress: string) => Effect.Effect<Cw20TokenInfo, TimeoutException | QueryContractError, Client>
Source: src/Cosmos.ts:487
Added in v2.0.0
Read CW20 token total_supply
Signature
export declare const readCw20TotalSupply: ( contractAddress: string) => Effect.Effect<string, TimeoutException | QueryContractError, Client>
Source: src/Cosmos.ts:498
Added in v2.0.0
Read CW20 token total_supply
Signature
export declare const readCw20TotalSupplyAtHeight: ( rest: string, contractAddress: string, height: number) => Effect.Effect<string, QueryContractError, never>
Source: src/Cosmos.ts:550
Added in v2.0.0
Signature
export declare const sendInstruction: ( instruction: Ucs03.Instruction, address: string, funds?: NonEmptyReadonlyArray<{ denom: string; amount: string }>) => Effect.Effect<ExecuteResult, ExecuteContractError | Utils.CryptoError, SigningClient | ChannelSource>
Source: src/Cosmos.ts:723
Added in v2.0.0
Increase the allowance of a CW20 token for a specific spender.
Signature
export declare const writeCw20IncreaseAllowance: ( contractAddress: string, senderAddress: string, spenderAddress: string, amount: string) => Effect.Effect<ExecuteResult, ExecuteContractError, SigningClient>
Source: src/Cosmos.ts:624
Added in v2.0.0