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:89
Signature
export declare class ChannelSource
Added in v2.0.0
Source: src/Cosmos.ts:103
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:146
Context for providing a CosmWasmClient for the destination chain
Signature
export declare class ClientDestination
Added in v2.0.0
Source: src/Cosmos.ts:132
Context for providing a CosmWasmClient for the source chain
Signature
export declare class ClientSource
Added in v2.0.0
Source: src/Cosmos.ts:119
Signature
export declare class DestinationConfig
Added in v2.0.0
Source: src/Cosmos.ts:178
Context for providing a SigningCosmWasmClient
Signature
export declare class SigningClient
Added in v2.0.0
Source: src/Cosmos.ts:159
Error type for CosmWasm client failures
Signature
export declare class ClientError
Added in v2.0.0
Source: src/Cosmos.ts:189
Error type for CosmWasm contract execution failures
Signature
export declare class ExecuteContractError
Added in v2.0.0
Source: src/Cosmos.ts:212
Error when fetching a balance at latest height
Signature
export declare class GetBalanceError
Added in v2.0.0
Source: src/Cosmos.ts:235
Error when fetching the latest block height
Signature
export declare class GetHeightError
Added in v2.0.0
Source: src/Cosmos.ts:225
Error type for HttpRequest execution failures
Signature
export declare class HttpRequestFailed
Added in v2.0.0
Source: src/Cosmos.ts:366
Error type for CosmWasm contract query failures
Signature
export declare class QueryContractError
Added in v2.0.0
Source: src/Cosmos.ts:199
Added in v2.0.0
Signature
export interface Channel { readonly ucs03address: string readonly channelId: number}
Source: src/Cosmos.ts:40
Added in v2.0.0
Signature
export interface PublicClient { client: CosmWasmClient}
Source: src/Cosmos.ts:23
Added in v2.0.0
Signature
export interface SigningClient { client: SigningCosmWasmClient address: string}
Source: src/Cosmos.ts:31
Added in v2.0.0
Interface for CW20 token balance response
Signature
export interface Cw20AllowanceResponse { allowance: number expiration: any // XXX}
Source: src/Cosmos.ts:494
Added in v2.0.0
Interface for CW20 token balance response
Signature
export interface Cw20BalanceResponse { balance: string}
Source: src/Cosmos.ts:484
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:471
Added in v2.0.0
Signature
export declare const channelBalance: ( path: bigint, token: string) => Effect.Effect<unknown, TimeoutException | QueryContractError, Client | ChannelDestination>
Source: src/Cosmos.ts:680
Added in v2.0.0
Signature
export declare const channelBalanceAtHeight: ( rest: string, path: bigint, token: string, height: number) => Effect.Effect<string, QueryContractError | NoSuchElementException, ChannelDestination>
Source: src/Cosmos.ts:698
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:291
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:422
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:340
Added in v2.0.0
Wrap CosmWasmClient.getHeight() in an Effect
Signature
export declare function getChainHeight(client: CosmWasmClient)
Source: src/Cosmos.ts:322
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:665
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:251
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:377
Added in v2.0.0
Read the allowance of a CW20 token for a specific addresses
Signature
export declare const readCw20Allowance: ( contract: Ucs05.CosmosDisplay, owner: Ucs05.CosmosDisplay, spender: Ucs05.CosmosDisplay) => Effect.Effect<number, TimeoutException | QueryContractError, Client>
Source: src/Cosmos.ts:616
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:596
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:537
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:507
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:518
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:570
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:644
Added in v2.0.0