import type { Account, Call, EstimateFeeResponseOverhead, RpcProvider, Signature, TypedData } from "starknet"; import type { Tx } from "../tx/index.js"; import type { TxBuilder } from "../tx/builder.js"; import type { Erc20 } from "../erc20/index.js"; import type { Staking, EndurStaking, EndurStakingOptions } from "../staking/index.js"; import type { LendingClient } from "../lending/index.js"; import type { DcaClientInterface } from "../dca/index.js"; import type { Troves, TrovesOptions } from "../troves/index.js"; import type { PreparedSwap, SwapInput, SwapProvider, SwapQuote } from "../swap/index.js"; import type { Address, Amount, ChainId, DeployOptions, EnsureReadyOptions, ExecuteOptions, FeeMode, PoolMember, PreflightOptions, PreflightResult, Token } from "../types/index.js"; import type { BridgeOperatorInterface } from "../bridge/operator/BridgeOperatorInterface.js"; /** * Interface for a connected Starknet wallet. * * This interface defines the contract that all wallet implementations must follow, * allowing for different wallet providers (custom signers, Privy, etc.) * to be used interchangeably. * * @example * ```ts * // Using with custom signer * const wallet = await sdk.connectWallet({ * account: { signer: new StarkSigner(privateKey) } * }); * * // All wallet implementations share WalletInterface * await wallet.execute([...]); * ``` */ export interface WalletInterface extends BridgeOperatorInterface { /** The wallet's Starknet address */ readonly address: Address; /** * Check if the account contract is deployed on-chain. */ isDeployed(): Promise; /** * Ensure the wallet is ready for transactions. * Optionally deploys the account if needed. */ ensureReady(options?: EnsureReadyOptions): Promise; /** * Deploy the account contract. * Returns a Tx object to track the deployment. * * @param options.feeMode - How to pay for deployment ("user_pays" or { type: "paymaster" }) */ deploy(options?: DeployOptions): Promise; /** * Execute one or more contract calls. * Returns a Tx object to track the transaction. */ execute(calls: Call[], options?: ExecuteOptions): Promise; /** * Call a read-only contract entrypoint. * * This executes an RPC `call` without sending a transaction. * Use this for view methods that don't mutate state. */ callContract(call: Call): ReturnType; /** * Create a transaction builder for batching multiple operations into a single transaction. * * Chain operations fluently and call `.send()` to execute them atomically. * * @example * ```ts * const tx = await wallet.tx() * .transfer(USDC, { to: alice, amount: Amount.parse("50", USDC) }) * .enterPool(poolAddress, Amount.parse("100", STRK)) * .send(); * ``` */ tx(): TxBuilder; /** * Simulate a transaction to check if it would succeed. */ preflight(options: PreflightOptions): Promise; /** * Estimate the fee for executing calls. */ estimateFee(calls: Call[]): Promise; /** * Sign a typed data message (EIP-712 style). * Returns the signature. */ signMessage(typedData: TypedData): Promise; /** * Disconnect the wallet and clean up resources. */ disconnect(): Promise; /** * Get the underlying starknet.js Account instance. * Use this for advanced operations not covered by the SDK. */ getAccount(): Account; /** * Get the RPC provider instance. * Use this for read-only operations like balance queries. */ getProvider(): RpcProvider; /** * Get the chain ID this wallet is connected to. */ getChainId(): ChainId; /** * Get the default fee mode for this wallet. */ getFeeMode(): FeeMode; /** * Get the account class hash. */ getClassHash(): string; /** * Get the display username when supported (e.g. Cartridge). * Returns undefined for wallets that don't provide this. */ username?(): Promise; /** * Gets or creates an Erc20 instance for the given token. */ erc20(token: Token): Erc20; /** * Transfer ERC20 tokens to one or more recipients. */ transfer(token: Token, transfers: { to: Address; amount: Amount; }[], options?: ExecuteOptions): Promise; /** * Get the wallet's balance of an ERC20 token. */ balanceOf(token: Token): Promise; /** * Fetch a quote. * * Set `request.provider` to a provider instance or provider id. * If omitted, uses the wallet default provider. */ getQuote(request: SwapInput): Promise; /** * Prepare a swap without executing it. * * Advanced API for batching, simulation, or custom execution flows. * Most apps should prefer `wallet.swap(...)`. */ prepareSwap(request: SwapInput): Promise; /** * Execute a swap. * * Set `request.provider` to a provider instance or provider id. * If omitted, uses the wallet default provider. */ swap(request: SwapInput, options?: ExecuteOptions): Promise; /** * Register or replace a swap provider on this wallet. */ registerSwapProvider(provider: SwapProvider, makeDefault?: boolean): void; /** * Set the default swap provider by id. */ setDefaultSwapProvider(providerId: string): void; /** * Resolve a registered provider by id. */ getSwapProvider(providerId: string): SwapProvider; /** * Resolve the wallet default swap provider. */ getDefaultSwapProvider(): SwapProvider; /** * List registered swap provider ids. */ listSwapProviders(): string[]; /** * Access DCA helpers for protocol-native recurring orders and per-cycle swap previews. */ dca(): DcaClientInterface; /** * Access lending helpers and protocol connectors (Vesu, etc.). */ lending(): LendingClient; /** * Get or create a Staking instance for a specific pool. */ staking(poolAddress: Address): Promise; /** * Get or create a Staking instance for a validator's pool. */ stakingInStaker(stakerAddress: Address, token: Token): Promise; /** * Enter a delegation pool as a new member. */ enterPool(poolAddress: Address, amount: Amount, options?: ExecuteOptions): Promise; /** * Add more tokens to an existing stake in a pool. */ addToPool(poolAddress: Address, amount: Amount, options?: ExecuteOptions): Promise; /** * Stake in a pool, automatically entering or adding based on membership. */ stake(poolAddress: Address, amount: Amount, options?: ExecuteOptions): Promise; /** * Claim accumulated staking rewards from a pool. */ claimPoolRewards(poolAddress: Address, options?: ExecuteOptions): Promise; /** * Initiate an exit from a delegation pool. */ exitPoolIntent(poolAddress: Address, amount: Amount, options?: ExecuteOptions): Promise; /** * Complete the exit from a delegation pool. */ exitPool(poolAddress: Address, options?: ExecuteOptions): Promise; /** * Check if the wallet is a member of a delegation pool. */ isPoolMember(poolAddress: Address): Promise; /** * Get the wallet's staking position in a pool. */ getPoolPosition(poolAddress: Address): Promise; /** * Get the validator's commission rate for a pool. */ getPoolCommission(poolAddress: Address): Promise; /** * Get an EndurStaking instance for an LST asset (e.g. "STRK", "WBTC"). * * `EndurStaking` mirrors the `Staking` API — use `enter`, `exitIntent`, `getPosition`, etc. */ lstStaking(asset: string, options?: EndurStakingOptions): EndurStaking; /** * Get a Troves client for interacting with Troves DeFi strategies. * * The same instance is returned across calls. **Options only apply on the * first call** — subsequent calls ignore them and return the cached * instance. Construct `Troves` directly if you need different settings * after the cache is warm. * * Throws on non-mainnet chains unless `options.apiBase` is provided * (Troves is a mainnet-only service). */ troves(options?: TrovesOptions): Troves; } //# sourceMappingURL=interface.d.ts.map