Evm.ts
This module handles EVM related functionality.
Added in v0.0.0
Signature
export declare class ChannelDestination
Added in v0.0.0
Source: src/Evm.ts:268
Signature
export declare class ChannelSource
Added in v0.0.0
Source: src/Evm.ts:282
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 PublicClient
Added in v0.0.0
Source: src/Evm.ts:324
Signature
export declare class PublicClientDestination
Added in v0.0.0
Source: src/Evm.ts:308
Signature
export declare class PublicClientSource
Added in v0.0.0
Source: src/Evm.ts:297
A wallet client that can be used for signing transactions
Signature
export declare class WalletClient
Added in v0.0.0
Source: src/Evm.ts:337
Signature
export declare class CreatePublicClientError
Added in v0.0.0
Source: src/Evm.ts:374
Signature
export declare class CreateWalletClientError
Added in v0.0.0
Source: src/Evm.ts:384
Signature
export declare class ReadContractError
Added in v0.0.0
Source: src/Evm.ts:348
Signature
export declare class SimulateContractError
Added in v0.0.0
Source: src/Evm.ts:364
Signature
export declare class WaitForTransactionReceiptError
Added in v0.0.0
Source: src/Evm.ts:116
Signature
export declare class WriteContractError
Added in v0.0.0
Source: src/Evm.ts:356
Added in v0.0.0
Signature
export interface Channel { readonly ucs03address: Address readonly channelId: number}
Source: src/Evm.ts:67
Added in v0.0.0
Signature
export interface PublicClient { readonly client: ViemPublicClient}
Source: src/Evm.ts:49
Added in v0.0.0
Signature
export interface WalletClient { readonly client: ViemWalletClient readonly account: ViemAccount readonly chain: ViemChain}
Source: src/Evm.ts:57
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:77
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:95
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:586
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:156
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:563
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:432
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:454
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:508
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:399
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:476
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:492
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:545
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:525
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:621
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:225
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:130
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:195
Added in v0.0.0