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:368
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: Ucs05.CosmosDisplay 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:496
Added in v2.0.0
Interface for CW20 token balance response
Signature
export interface Cw20BalanceResponse { balance: string}
Source: src/Cosmos.ts:486
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:473
Added in v2.0.0
Signature
export declare const channelBalance: ( path: bigint, token: string) => Effect.Effect.AsEffect<Effect.Effect<unknown, TimeoutException | QueryContractError, Client | ChannelDestination>>
Source: src/Cosmos.ts:672
Added in v2.0.0
Signature
export declare const channelBalanceAtHeight: ( rest: string, path: bigint, token: string, height: number) => Effect.Effect< string, [ | YieldWrap<Context.Tag<ChannelDestination, Cosmos.Channel>> | YieldWrap<Effect.Effect<{ data: string | undefined }, QueryContractError, never>> | YieldWrap<O.None<string>> | YieldWrap<O.Some<string>> ] extends [never] ? never : [ | YieldWrap<Context.Tag<ChannelDestination, Cosmos.Channel>> | YieldWrap<Effect.Effect<{ data: string | undefined }, QueryContractError, never>> | YieldWrap<O.None<string>> | YieldWrap<O.Some<string>> ] extends [YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never, [ | YieldWrap<Context.Tag<ChannelDestination, Cosmos.Channel>> | YieldWrap<Effect.Effect<{ data: string | undefined }, QueryContractError, never>> | YieldWrap<O.None<string>> | YieldWrap<O.Some<string>> ] extends [never] ? never : [ | YieldWrap<Context.Tag<ChannelDestination, Cosmos.Channel>> | YieldWrap<Effect.Effect<{ data: string | undefined }, QueryContractError, never>> | YieldWrap<O.None<string>> | YieldWrap<O.Some<string>> ] extends [YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never>
Source: src/Cosmos.ts:691
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:424
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:342
Added in v2.0.0
Wrap CosmWasmClient.getHeight() in an Effect
Signature
export declare const getChainHeight: Effect.Effect<number, TimeoutException | GetHeightError, Client>
Source: src/Cosmos.ts:322
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: Ucs05.CosmosDisplay, 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: Ucs05.CosmosDisplay, queryMsg: Record<string, unknown>, height: number)
Source: src/Cosmos.ts:379
Added in v2.0.0
Read the allowance of a CW20 token for a specific addresses
Signature
export declare const readCw20Allowance: ( contract: { readonly _tag: "CosmosDisplay"; readonly address: `${string}1${string}` }, owner: { readonly _tag: "CosmosDisplay"; readonly address: `${string}1${string}` }, spender: { readonly _tag: "CosmosDisplay"; readonly address: `${string}1${string}` }) => Effect.Effect.AsEffect<Effect.Effect<number, TimeoutException | QueryContractError, Client>>
Source: src/Cosmos.ts:626
Added in v2.0.0
Read the balance of a CW20 token for a specific address
Signature
export declare const readCw20Balance: ( contractAddress: { readonly _tag: "CosmosDisplay"; readonly address: `${string}1${string}` }, address: string) => Effect.Effect.AsEffect<Effect.Effect<string, TimeoutException | QueryContractError, Client>>
Source: src/Cosmos.ts:602
Added in v2.0.0
Read the balance of a CW20 token for a specific address
Signature
export declare const readCw20BalanceAtHeight: ( rest: string, contractAddress: Ucs05.CosmosDisplay, address: string, height: number) => Effect.Effect<string, QueryContractError, never>
Source: src/Cosmos.ts:543
Added in v2.0.0
Read CW20 token metadata (name, symbol, decimals, total_supply)
Signature
export declare const readCw20TokenInfo: (contractAddress: { readonly _tag: "CosmosDisplay" readonly address: `${string}1${string}`}) => Effect.Effect.AsEffect<Effect.Effect<Cw20TokenInfo, TimeoutException | QueryContractError, Client>>
Source: src/Cosmos.ts:509
Added in v2.0.0
Read CW20 token total_supply
Signature
export declare const readCw20TotalSupply: (contractAddress: { readonly _tag: "CosmosDisplay" readonly address: `${string}1${string}`}) => Effect.Effect.AsEffect<Effect.Effect<string, TimeoutException | QueryContractError, Client>>
Source: src/Cosmos.ts:521
Added in v2.0.0
Read CW20 token total_supply
Signature
export declare const readCw20TotalSupplyAtHeight: ( rest: string, contractAddress: Ucs05.CosmosDisplay, height: number) => Effect.Effect<string, QueryContractError, never>
Source: src/Cosmos.ts:576
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:655
Added in v2.0.0