Evm.ts
This module handles EVM related functionality.
Added in v0.0.0
Signature
export declare class ChannelDestinationAdded in v0.0.0
Source: src/Evm.ts:270
Signature
export declare class ChannelSourceAdded in v0.0.0
Source: src/Evm.ts:284
A neutral public client that can be used for general-purpose operations that don’t specifically target source or destination chains
Signature
export declare class PublicClientAdded in v0.0.0
Source: src/Evm.ts:326
Signature
export declare class PublicClientDestinationAdded in v0.0.0
Source: src/Evm.ts:310
Signature
export declare class PublicClientSourceAdded in v0.0.0
Source: src/Evm.ts:299
A wallet client that can be used for signing transactions
Signature
export declare class WalletClientAdded in v0.0.0
Source: src/Evm.ts:339
Signature
export declare class CreatePublicClientErrorAdded in v0.0.0
Source: src/Evm.ts:376
Signature
export declare class CreateWalletClientErrorAdded in v0.0.0
Source: src/Evm.ts:386
Signature
export declare class ReadContractErrorAdded in v0.0.0
Source: src/Evm.ts:350
Signature
export declare class SimulateContractErrorAdded in v0.0.0
Source: src/Evm.ts:366
Signature
export declare class WaitForTransactionReceiptErrorAdded in v0.0.0
Source: src/Evm.ts:118
Signature
export declare class WriteContractErrorAdded in v0.0.0
Source: src/Evm.ts:358
Added in v0.0.0
Signature
export interface Channel { readonly ucs03address: Address readonly channelId: number}Source: src/Evm.ts:69
Added in v0.0.0
Signature
export interface PublicClient { readonly client: ViemPublicClient}Source: src/Evm.ts:51
Added in v0.0.0
Signature
export interface WalletClient { readonly client: ViemWalletClient readonly account: ViemAccount readonly chain: ViemChain}Source: src/Evm.ts:59
Added in v0.0.0
Signature
export declare const channelBalance: ( path: bigint, token: `0x${string}`) => Effect.Effect.AsEffect<Effect.Effect<bigint, ReadContractError, PublicClient | ChannelDestination>>Source: src/Evm.ts:79
Added in v0.0.0
Signature
export declare const channelBalanceAtBlock: ( path: bigint, token: `0x${string}`, blockNumber: bigint) => Effect.Effect< bigint, [ | YieldWrap<Context.Tag<ChannelDestination, Evm.Channel>> | YieldWrap<Context.Tag<PublicClientDestination, Evm.PublicClient>> | YieldWrap<Effect.Effect<bigint, ReadContractError, never>> ] extends [never] ? never : [ | YieldWrap<Context.Tag<ChannelDestination, Evm.Channel>> | YieldWrap<Context.Tag<PublicClientDestination, Evm.PublicClient>> | YieldWrap<Effect.Effect<bigint, ReadContractError, never>> ] extends [YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never, [ | YieldWrap<Context.Tag<ChannelDestination, Evm.Channel>> | YieldWrap<Context.Tag<PublicClientDestination, Evm.PublicClient>> | YieldWrap<Effect.Effect<bigint, ReadContractError, never>> ] extends [never] ? never : [ | YieldWrap<Context.Tag<ChannelDestination, Evm.Channel>> | YieldWrap<Context.Tag<PublicClientDestination, Evm.PublicClient>> | YieldWrap<Effect.Effect<bigint, ReadContractError, never>> ] extends [YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never>Source: src/Evm.ts:97
Added in v0.0.0
Increase the allowance of an ERC20 token for a specific spender
Signature
export declare const increaseErc20Allowance: ( tokenAddress: `0x${string}`, spenderAddress: { readonly address: `0x${string}`; readonly _tag: "EvmDisplay" }, amount: bigint) => Effect.Effect.AsEffect<Effect.Effect<string, UnknownException | Safe.SafeError, WalletClient>>Source: src/Evm.ts:588
Added in v0.0.0
A type-safe wrapper around viem’s readContract that handles error cases and returns an Effect with proper type inference. Extracts all error info
Signature
export declare const readContract: < TAbi extends Abi, TFunctionName extends ContractFunctionName<TAbi, "pure" | "view"> = ContractFunctionName<TAbi, "pure" | "view">, TArgs extends ContractFunctionArgs<TAbi, "pure" | "view", TFunctionName> = ContractFunctionArgs< TAbi, "pure" | "view", TFunctionName >>( params: ReadContractParameters<TAbi, TFunctionName, TArgs>) => Effect.Effect.AsEffect< Effect.Effect< ContractFunctionReturnType<TAbi, "pure" | "view", TFunctionName, TArgs>, ReadContractError, PublicClient >>Source: src/Evm.ts:158
Added in v0.0.0
Read the allowance of an ERC20 token for a specific owner and spender
Signature
export declare const readErc20Allowance: ( tokenAddress: `0x${string}`, ownerAddress: `0x${string}`, spenderAddress: `0x${string}`) => Effect.Effect.AsEffect<Effect.Effect.AsEffect<Effect.Effect<bigint, ReadContractError, PublicClient>>>Source: src/Evm.ts:565
Added in v0.0.0
Read the balance of an ERC20 token for a specific address
Signature
export declare const readErc20Balance: ( tokenAddress: `0x${string}`, ownerAddress: { readonly address: `0x${string}`; readonly _tag: "EvmDisplay" }) => Effect.Effect.AsEffect<Effect.Effect.AsEffect<Effect.Effect<bigint, ReadContractError, PublicClient>>>Source: src/Evm.ts:434
Added in v0.0.0
Read the balance of an ERC20 token for a specific address
Signature
export declare const readErc20BalanceAtBlock: ( tokenAddress: `0x${string}`, ownerAddress: `0x${string}`, blockNumber: bigint) => Effect.Effect.AsEffect<Effect.Effect.AsEffect<Effect.Effect<bigint, ReadContractError, PublicClient>>>Source: src/Evm.ts:456
Added in v0.0.0
Read the decimals of an ERC20 token
Signature
export declare const readErc20Decimals: ( tokenAddress: `0x${string}`) => Effect.Effect.AsEffect<Effect.Effect.AsEffect<Effect.Effect<number, ReadContractError, PublicClient>>>Source: src/Evm.ts:510
Added in v0.0.0
Read ERC20 token metadata (name, symbol, decimals)
Signature
export declare const readErc20Meta: ( tokenAddress: `0x${string}`, chainId: string & Brand<"UniversalChainId">) => Effect.Effect< { name: string; symbol: string; decimals: number }, [ | YieldWrap<Effect.Effect<string, ReadContractError, PublicClient>> | YieldWrap<Effect.Effect<number, ReadContractError, PublicClient>> ] extends [never] ? never : [ | YieldWrap<Effect.Effect<string, ReadContractError, PublicClient>> | YieldWrap<Effect.Effect<number, ReadContractError, PublicClient>> ] extends [YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never, [ | YieldWrap<Effect.Effect<string, ReadContractError, PublicClient>> | YieldWrap<Effect.Effect<number, ReadContractError, PublicClient>> ] extends [never] ? never : [ | YieldWrap<Effect.Effect<string, ReadContractError, PublicClient>> | YieldWrap<Effect.Effect<number, ReadContractError, PublicClient>> ] extends [YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never>Source: src/Evm.ts:401
Added in v0.0.0
Read the name of an ERC20 token
Signature
export declare const readErc20Name: ( tokenAddress: `0x${string}`) => Effect.Effect.AsEffect<Effect.Effect.AsEffect<Effect.Effect<string, ReadContractError, PublicClient>>>Source: src/Evm.ts:478
Added in v0.0.0
Read the symbol of an ERC20 token
Signature
export declare const readErc20Symbol: ( tokenAddress: `0x${string}`) => Effect.Effect.AsEffect<Effect.Effect.AsEffect<Effect.Effect<string, ReadContractError, PublicClient>>>Source: src/Evm.ts:494
Added in v0.0.0
Read the TotalSupply of an ERC20 token
Signature
export declare const readErc20TotalSupply: ( tokenAddress: `0x${string}`) => Effect.Effect.AsEffect<Effect.Effect.AsEffect<Effect.Effect<bigint, ReadContractError, PublicClient>>>Source: src/Evm.ts:547
Added in v0.0.0
Read the TotalSupply of an ERC20 token
Signature
export declare const readErc20TotalSupplyAtBlock: ( tokenAddress: `0x${string}`, blockNumber: bigint) => Effect.Effect.AsEffect<Effect.Effect.AsEffect<Effect.Effect<bigint, ReadContractError, PublicClient>>>Source: src/Evm.ts:527
Added in v0.0.0
Signature
export declare const sendInstruction: ( instruction: Ucs03.Instruction) => Effect.Effect< `0x${string}`, [ | YieldWrap<Context.Tag<WalletClient, Evm.WalletClient>> | YieldWrap<Context.Tag<ChannelSource, Evm.Channel>> | YieldWrap<Effect.Effect<`0x${string}`, Utils.CryptoError, never>> | YieldWrap<Effect.Effect<`0x${string}`, ParseError, never>> | YieldWrap<Effect.Effect<`0x${string}`, WriteContractError, WalletClient>> ] extends [never] ? never : [ | YieldWrap<Context.Tag<WalletClient, Evm.WalletClient>> | YieldWrap<Context.Tag<ChannelSource, Evm.Channel>> | YieldWrap<Effect.Effect<`0x${string}`, Utils.CryptoError, never>> | YieldWrap<Effect.Effect<`0x${string}`, ParseError, never>> | YieldWrap<Effect.Effect<`0x${string}`, WriteContractError, WalletClient>> ] extends [YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never, [ | YieldWrap<Context.Tag<WalletClient, Evm.WalletClient>> | YieldWrap<Context.Tag<ChannelSource, Evm.Channel>> | YieldWrap<Effect.Effect<`0x${string}`, Utils.CryptoError, never>> | YieldWrap<Effect.Effect<`0x${string}`, ParseError, never>> | YieldWrap<Effect.Effect<`0x${string}`, WriteContractError, WalletClient>> ] extends [never] ? never : [ | YieldWrap<Context.Tag<WalletClient, Evm.WalletClient>> | YieldWrap<Context.Tag<ChannelSource, Evm.Channel>> | YieldWrap<Effect.Effect<`0x${string}`, Utils.CryptoError, never>> | YieldWrap<Effect.Effect<`0x${string}`, ParseError, never>> | YieldWrap<Effect.Effect<`0x${string}`, WriteContractError, WalletClient>> ] extends [YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never>Source: src/Evm.ts:623
Added in v0.0.0
Signature
export declare const simulateContract: < abi extends Abi | readonly unknown[] = Abi, functionName extends ContractFunctionName<abi, "nonpayable" | "payable"> = ContractFunctionName< abi, "nonpayable" | "payable" >, args extends ContractFunctionArgs<abi, "nonpayable" | "payable", functionName> = ContractFunctionArgs< abi, "nonpayable" | "payable", functionName >, chain extends ViemChain | undefined = ViemChain | undefined, chainOverride extends ViemChain | undefined = ViemChain | undefined, accountOverride extends ViemAccount | Address | null | undefined = undefined, derivedChain extends ViemChain | undefined = DeriveChain<chain, chainOverride>>( params: SimulateContractParameters<abi, functionName, args, chain, chainOverride, accountOverride>) => Effect.Effect< SimulateContractReturnType< abi, functionName, args, ViemChain | undefined, ViemAccount | undefined, chainOverride, `0x${string}` | ViemAccount | undefined >, SimulateContractError, PublicClient>Source: src/Evm.ts:227
Added in v0.0.0
Wait for a transaction receipt
Signature
export declare const waitForTransactionReceipt: ( hash: `0x${string}`) => Effect.Effect.AsEffect<Effect.Effect<TransactionReceipt, WaitForTransactionReceiptError, PublicClient>>Source: src/Evm.ts:132
Added in v0.0.0
A type-safe wrapper around viem’s writeContract that handles error cases and returns an Effect with proper type inference. Extracts all error info
Signature
export declare const writeContract: < const abi extends Abi | readonly unknown[], functionName extends ContractFunctionName<abi, "nonpayable" | "payable">, args extends ContractFunctionArgs<abi, "nonpayable" | "payable", functionName>, chainOverride extends ViemChain | undefined = undefined>( params: WriteContractParameters<abi, functionName, args>) => Effect.Effect.AsEffect<Effect.Effect<`0x${string}`, WriteContractError, WalletClient>>Source: src/Evm.ts:197
Added in v0.0.0