WalletClient.ts
This module provides the agnostic wallet client.
Added in v0.4.0
constructors
Section titled “constructors”Signature
export declare const make: (options: WalletClient.MakeOptions) => Effect.Effect<WalletClient, never, never>Added in v0.4.0
models
Section titled “models”DestinationWalletClient (class)
Section titled “DestinationWalletClient (class)”Signature
export declare class DestinationWalletClientAdded in v0.4.0
SourceWalletClient (class)
Section titled “SourceWalletClient (class)”Signature
export declare class SourceWalletClientAdded in v0.4.0
WalletClient
Section titled “WalletClient”Signature
export declare const WalletClient: Context.Tag<WalletClient, WalletClient>Added in v0.4.0
WalletClient (interface)
Section titled “WalletClient (interface)”Signature
export interface WalletClient { /** * @since 0.4.0 */ readonly [TypeId]: TypeId /** * Approve the ZAsset for the provided ERC20 token to spend the ERC20. * * The ZAsset address is derived from Z_ASSET_REGISTRY. */ readonly approveZAssetToSpendErc20: ( args: WalletClient.ApproveZAssetToSpendErc20 ) => Effect.Effect<Domain.PreparedRequest, SdkError, never>
/** * Deposit ("wrap") the ERC20 into it's ZAsset. * * The ZAsset address is derived from Z_ASSET_REGISTRY. */ readonly depositUnderlyingZAsset: ( args: WalletClient.DepositUnderlyingZAsset ) => Effect.Effect<Domain.PreparedRequest, SdkError, never>
/** * Transfer the deposited ZAsset to the provided deposit address. * * The ZAsset address is derived from Z_ASSET_REGISTRY. */ readonly transferZAsset: (args: WalletClient.TransferZAsset) => Effect.Effect<Domain.PreparedRequest, SdkError, never>
readonly updateLoopbackClient: ( args: WalletClient.UpdateLoopbackClient ) => Effect.Effect<Domain.PreparedRequest, SdkError, never>
readonly prepareDeposit: (args: WalletClient.Deposit) => Effect.Effect<Domain.PreparedRequests, SdkError, never>
/** * Prepare wrap transactions (approve + deposit). * * Returns 2 prepared calls: * 1. `approve` - Approve the zAsset contract to spend your ERC20 * 2. `wrap` - Wrap ERC20 to zAsset * * Use this when you want to handle subsequent operations (transfer, batch proxy, etc.) yourself. * * @example * ```ts * const [approveErc20, wrap] = await walletClient.prepareWrap({ * universalChainId: Domain.UniversalChainId.make("ethereum.1"), * srcErc20Address: Domain.Erc20Address(USDC_ADDRESS), * amount: totalAmount, * }); * * // Add your own calls (e.g., batch proxy approval + transfer) * const calls = EvmWalletClient.toBatchCalls([approveErc20, wrap, myApproval, myTransfer]); * await walletClient.sendCalls(calls); * ``` */ readonly prepareWrap: (args: WalletClient.Wrap) => Effect.Effect<Domain.PreparedWrapRequests, SdkError, never>
readonly prepareRedemption: (args: WalletClient.Redeem) => Effect.Effect<Domain.PreparedRequest, SdkError, never>
readonly sign: ( request: ReadonlyArray<Domain.PreparedRequest> | Domain.PreparedRequest ) => Effect.Effect<Domain.SignedRequest[], SdkError, never>
// TODO: can be done by public client (?) readonly submit: (request: Domain.SignedRequest) => Effect.Effect<Domain.SubmissionResult, SdkError, never>
readonly signAndSubmit: (request: Domain.PreparedRequest) => Effect.Effect<Domain.SubmissionResult, SdkError, never>}Added in v0.4.0
WalletClient (namespace)
Section titled “WalletClient (namespace)”Added in v0.4.0
ApproveZAssetToSpendErc20 (interface)
Section titled “ApproveZAssetToSpendErc20 (interface)”Signature
export interface ApproveZAssetToSpendErc20 { universalChainId: Domain.UniversalChainId srcErc20Address: Domain.Erc20Address amount: bigint}Added in v0.4.0
DepositUnderlyingZAsset (interface)
Section titled “DepositUnderlyingZAsset (interface)”Signature
export interface DepositUnderlyingZAsset { universalChainId: Domain.UniversalChainId srcErc20Address: Domain.Erc20Address amount: bigint}Added in v0.4.0
MakeOptions (interface)
Section titled “MakeOptions (interface)”Signature
export interface MakeOptions { readonly sign: WalletClient["sign"] readonly submit: WalletClient["submit"] readonly signAndSubmit: WalletClient["signAndSubmit"] readonly approveZAssetToSpendErc20: WalletClient["approveZAssetToSpendErc20"] readonly depositUnderlyingZAsset: WalletClient["depositUnderlyingZAsset"] readonly transferZAsset: WalletClient["transferZAsset"] readonly updateLoopbackClient: WalletClient["updateLoopbackClient"] readonly prepareWrap: WalletClient["prepareWrap"] readonly prepareDeposit: WalletClient["prepareDeposit"] readonly prepareRedemption: WalletClient["prepareRedemption"]}Added in v0.4.0
TransferZAsset (interface)
Section titled “TransferZAsset (interface)”Signature
export interface TransferZAsset { universalChainId: Domain.UniversalChainId srcErc20Address: Domain.Erc20Address depositAddress: `0x${string}` amount: bigint}Added in v0.4.0
UpdateLoopbackClient (interface)
Section titled “UpdateLoopbackClient (interface)”Signature
export interface UpdateLoopbackClient { universalChainId: Domain.UniversalChainId clientId: number height: bigint ibcHandlerAddress: Domain.IbcCoreAddress}Added in v0.4.0
Deposit (type alias)
Section titled “Deposit (type alias)”Signature
export type Deposit = { destinationChainId: Domain.UniversalChainId srcErc20Address: Domain.Erc20Address readonly beneficiaries: ReadonlyArray<Address> depositAddress: Domain.ZAssetAddress amount: bigint}Added in v0.4.0
Redeem (type alias)
Section titled “Redeem (type alias)”Signature
export type Redeem = { universalChainId: Domain.UniversalChainId dstErc20Address: Domain.Erc20Address unwrap?: boolean | undefined} & RedeemParamsAdded in v0.4.0
Wrap (type alias)
Section titled “Wrap (type alias)”Signature
export type Wrap = { universalChainId: Domain.UniversalChainId srcErc20Address: Domain.Erc20Address amount: bigint}Added in v0.3.2
type ids
Section titled “type ids”TypeId
Section titled “TypeId”Signature
export declare const TypeId: typeof TypeIdAdded in v0.4.0
TypeId (type alias)
Section titled “TypeId (type alias)”Signature
export type TypeId = typeof TypeIdAdded in v0.4.0