import { AccountData } from '@cosmjs/amino'; import { AminoConverters } from '@cosmjs/stargate'; import { AminoSignResponse } from '@cosmjs/amino'; import { Chain } from '@initia/initia-registry-types'; import { Coin } from 'cosmjs-types/cosmos/base/v1beta1/coin'; import { CreateConnectorFn } from 'wagmi'; import { DeliverTxResponse } from '@cosmjs/stargate'; import { EIP1193EventMap } from 'viem'; import { EIP1193RequestFn } from 'viem'; import { EIP1474Methods } from 'viem'; import { EncodeObject } from '@cosmjs/proto-signing'; import { GeneratedType } from '@cosmjs/proto-signing'; import { IndexedTx } from '@cosmjs/stargate'; import { JSX } from 'react/jsx-runtime'; import { OfflineAminoSigner } from '@cosmjs/amino'; import { PropsWithChildren } from 'react'; import { ProviderConnectInfo } from 'viem'; import { SimulateResponse } from 'cosmjs-types/cosmos/tx/v1beta1/service'; import { StdFee } from '@cosmjs/stargate'; import { StdSignDoc } from '@cosmjs/amino'; import { UseQueryResult } from '@tanstack/react-query'; import { Wallet } from '@rainbow-me/rainbowkit'; declare interface AssetOption { denom: string; chainId: string; } declare interface AutoSignFeePolicy { gasMultiplier?: number; maxGasMultiplierFromSim?: number; allowedFeeDenoms?: string[]; } declare interface Config { /** Chain id the widget targets by default. */ defaultChainId: string; /** Chain definition that overrides or extends the registry entry. */ customChain?: Chain; /** Extra proto message types merged into the signing registry. */ protoTypes?: Iterable<[string, GeneratedType]>; /** Extra amino converters merged into the signing registry. */ aminoConverters?: AminoConverters; /** Initia chain registry base URL. */ registryUrl: string; /** Router API (Skip) base URL for bridging and swaps. */ routerApiUrl: string; /** Glyph base URL for NFT image rendering. */ glyphUrl: string; /** Move module address for usernames. */ usernamesModuleAddress: string; /** Move module address for lock staking. */ lockStakeModuleAddress: string; /** Move module address for CLAMM vaults. */ clammVaultModuleAddress: string; /** Minity portfolio API base URL (SSE streaming). */ minityUrl: string; /** DEX indexer API base URL for LP prices and positions. */ dexUrl: string; /** VIP API base URL for vesting positions. */ vipUrl: string; /** Deposit API base URL; unset disables the deposit methods that rely on it. */ depositApiUrl?: string; /** Onramper API base URL; unset disables the cash method. */ onramperApiUrl?: string; /** Onramper publishable key (`pk_...`); override to bill your own account. */ onramperApiKey?: string; /** Color theme. */ theme: "light" | "dark"; /** Element the widget portals into instead of the default shadow root. */ container?: HTMLElement; /** Disables usage analytics. */ disableAnalytics?: boolean; /** Auto-sign opt-in: `true`, or a chain id → allowed message type URLs map. */ enableAutoSign?: boolean | Record; /** Per-chain fee policy for auto-signed transactions. */ autoSignFeePolicy?: Record; /** Cosmos wallets offered in the connect list. */ cosmosWallets?: CosmosWallet[]; } export declare interface CosmosWallet { name: string; image?: string; getProvider: () => CosmosWalletProvider | undefined; fallbackUrl?: string; } export declare interface CosmosWalletProvider { getOfflineSigner(chainId: string): OfflineAminoSigner; getOfflineSignerOnlyAmino(chainId: string): OfflineAminoSigner; } /** * Creates a Cosmos wallet for the Bridge wallet selection list, * backed by a mnemonic-derived `Secp256k1HdWallet` (standard Cosmos * secp256k1 signing). Designed for automated testing and local * development against chains like Noble and Neutron. * * Pass the returned wallet via the `cosmosWallets` config prop * on `InterwovenKitProvider`. It will appear in the Bridge's * "Connect wallet" list alongside Keplr. * * @example * ```ts * import { * InterwovenKitProvider, * createTestCosmosWallet, * } from "@initia/interwovenkit-react" * * const testCosmosWallet = createTestCosmosWallet({ * mnemonic: process.env.TEST_COSMOS_MNEMONIC!, * }) * * function App() { * return ( * * {children} * * ) * } * ``` */ export declare function createTestCosmosWallet(config: CreateTestCosmosWalletConfig): CosmosWallet; export declare interface CreateTestCosmosWalletConfig { /** * BIP-39 mnemonic phrase used to derive Cosmos accounts. */ mnemonic: string; /** * Display name shown in the wallet selection list. * @default "Test Cosmos Wallet" */ name?: string; /** * Wallet icon URL. Omit to show the default placeholder. */ image?: string; /** * Override the bech32 prefix for specific chain IDs. * By default, the prefix is derived from the chain ID * (e.g. `noble-1` → `noble`). Use this for chains where * the prefix differs from the chain ID stem. * * @example * ```ts * chains: { * "cosmoshub-4": { prefix: "cosmos" }, * "osmosis-1": { prefix: "osmo" }, * } * ``` */ chains?: Record; /** * Log signer creation to the console for debugging. * @default false */ debug?: boolean; } export declare type CreateTestWalletConfig = CreateTestWalletOptions & { /** * Wagmi connector id. Useful when running multiple test wallets. * Defaults to `"testWallet"` when `addressIndex` is omitted, or * `"testWallet-${addressIndex}"` when it is provided. */ id?: string; /** * Display name shown in wallet selection UI. * Defaults to `"Test Wallet"` when `addressIndex` is omitted, or * `"Test Wallet ${addressIndex}"` when it is provided. */ name?: string; /** * CORS-friendly RPC URLs keyed by chain ID. * User-provided URLs override built-in defaults for matching chain IDs. */ rpcUrls?: Record; /** * Log every RPC call to the console for debugging. * @default false */ debug?: boolean; /** * Override fields on every `eth_sendTransaction` call. * Useful for testing failure scenarios: * - `{ gas: 21000n }` — out of gas for contract calls (triggers revert) * - `{ maxFeePerGas: 1n }` — below base fee (rejected by RPC or stuck in mempool) */ sendTransactionOverrides?: { gas?: bigint; maxFeePerGas?: bigint; maxPriorityFeePerGas?: bigint; }; /** * Open a blank window before every signing request and fail with the same error as * popup-based wallets (Privy) when the browser blocks it. Lets browser tests check that * signing is still inside the click's user activation when the wallet is asked. * `delayMs` waits that long before opening the window, which is useful as a negative * control since the activation expires during the wait. * @default false */ simulatePopup?: boolean | { delayMs: number; }; }; /** * Creates a wagmi-compatible wallet connector from a mnemonic or * private key for automated testing and local development. * * Browser wallets require manual interaction (popups, confirmations) * that cannot be driven programmatically. This connector creates an * in-memory EIP-1193 wallet that handles chain switching, transaction * signing, and gas estimation entirely in code. Standard contract * interactions (e.g. ERC-20 approvals) work via the RPC proxy. * * @example * ```ts * import { createTestWalletConnector } from "@initia/interwovenkit-react" * * // From mnemonic * const connector = createTestWalletConnector({ * mnemonic: process.env.TEST_MNEMONIC!, * }) * * // Derive multiple connectors from one mnemonic. Explicit indexes also * // produce unique default ids and names for wagmi and wallet selection UIs. * const testConnectors = Array.from({ length: 40 }, (_, addressIndex) => * createTestWalletConnector({ * mnemonic: process.env.TEST_MNEMONIC!, * addressIndex, * }), * ) * * // Or from private key * const connector = createTestWalletConnector({ * privateKey: process.env.TEST_PRIVATE_KEY as `0x${string}`, * }) * * const config = createConfig({ * connectors: [connector, ...otherConnectors], * }) * ``` * * ### Supported EIP-1193 methods * * | Method | Behavior | * | --- | --- | * | `eth_requestAccounts`, `eth_accounts` | Returns the account address | * | `eth_chainId` | Returns current chain ID (hex) | * | `personal_sign` | Signs with the account | * | `eth_signTypedData`, `eth_signTypedData_v4` | Simplified: signs raw bytes (not EIP-712 compliant) | * | `wallet_switchEthereumChain` | Switches chain; auto-registers from rpcUrls; throws 4902 if no RPC known | * | `wallet_addEthereumChain` | Registers a new chain with its RPC URL | * | `wallet_getPermissions`, `wallet_requestPermissions` | Returns `eth_accounts` permission | * | `eth_sendTransaction` | Signs locally via viem, broadcasts to RPC | * | *(any other method)* | Proxied to the current chain's RPC node | */ export declare function createTestWalletConnector(options: CreateTestWalletConfig): CreateConnectorFn< { on: (event: event, listener: EIP1193EventMap[event]) => void; removeListener: (event: event, listener: EIP1193EventMap[event]) => void; request: EIP1193RequestFn; isApexWallet?: true | undefined; isAvalanche?: true | undefined; isBackpack?: true | undefined; isBifrost?: true | undefined; isBitKeep?: true | undefined; isBitski?: true | undefined; isBlockWallet?: true | undefined; isBraveWallet?: true | undefined; isCoinbaseWallet?: true | undefined; isDawn?: true | undefined; isEnkrypt?: true | undefined; isExodus?: true | undefined; isFrame?: true | undefined; isFrontier?: true | undefined; isGamestop?: true | undefined; isHyperPay?: true | undefined; isImToken?: true | undefined; isKuCoinWallet?: true | undefined; isMathWallet?: true | undefined; isMetaMask?: true | undefined; isOkxWallet?: true | undefined; isOKExWallet?: true | undefined; isOneInchAndroidWallet?: true | undefined; isOneInchIOSWallet?: true | undefined; isOpera?: true | undefined; isPhantom?: true | undefined; isPortal?: true | undefined; isRabby?: true | undefined; isRainbow?: true | undefined; isStatus?: true | undefined; isTally?: true | undefined; isTokenPocket?: true | undefined; isTokenary?: true | undefined; isTrust?: true | undefined; isTrustWallet?: true | undefined; isUniswapWallet?: true | undefined; isXDEFI?: true | undefined; isZerion?: true | undefined; providers?: { on: (event: event, listener: EIP1193EventMap[event]) => void; removeListener: (event: event, listener: EIP1193EventMap[event]) => void; request: EIP1193RequestFn; isApexWallet?: true | undefined; isAvalanche?: true | undefined; isBackpack?: true | undefined; isBifrost?: true | undefined; isBitKeep?: true | undefined; isBitski?: true | undefined; isBlockWallet?: true | undefined; isBraveWallet?: true | undefined; isCoinbaseWallet?: true | undefined; isDawn?: true | undefined; isEnkrypt?: true | undefined; isExodus?: true | undefined; isFrame?: true | undefined; isFrontier?: true | undefined; isGamestop?: true | undefined; isHyperPay?: true | undefined; isImToken?: true | undefined; isKuCoinWallet?: true | undefined; isMathWallet?: true | undefined; isMetaMask?: true | undefined; isOkxWallet?: true | undefined; isOKExWallet?: true | undefined; isOneInchAndroidWallet?: true | undefined; isOneInchIOSWallet?: true | undefined; isOpera?: true | undefined; isPhantom?: true | undefined; isPortal?: true | undefined; isRabby?: true | undefined; isRainbow?: true | undefined; isStatus?: true | undefined; isTally?: true | undefined; isTokenPocket?: true | undefined; isTokenary?: true | undefined; isTrust?: true | undefined; isTrustWallet?: true | undefined; isUniswapWallet?: true | undefined; isXDEFI?: true | undefined; isZerion?: true | undefined; providers?: /*elided*/ any[] | undefined | undefined; _events?: { connect?: (() => void) | undefined; } | undefined | undefined; _state?: { accounts?: string[]; initialized?: boolean; isConnected?: boolean; isPermanentlyDisconnected?: boolean; isUnlocked?: boolean; } | undefined | undefined; }[] | undefined | undefined; _events?: { connect?: (() => void) | undefined; } | undefined | undefined; _state?: { accounts?: string[]; initialized?: boolean; isConnected?: boolean; isPermanentlyDisconnected?: boolean; isUnlocked?: boolean; } | undefined | undefined; } | undefined, { onConnect(connectInfo: ProviderConnectInfo): void; }, { [x: `${string}.disconnected`]: true; "injected.connected": true; }>; export declare type CreateTestWalletOptions = { /** * BIP-39 mnemonic phrase. Provide either `mnemonic` or `privateKey`. */ mnemonic: string; /** * Address index in the HD path (`m/44'/60'/0'/0/${addressIndex}`). * @default 0 */ addressIndex?: number; privateKey?: never; } | { mnemonic?: never; addressIndex?: never; /** * Hex-encoded private key (with `0x` prefix). * Provide either `mnemonic` or `privateKey`. */ privateKey: `0x${string}`; }; export declare const DEFAULT_GAS_ADJUSTMENT = 1.4; export declare const DEFAULT_GAS_PRICE_MULTIPLIER = 1.05; declare interface EnableAutoSignOptions { defaultDuration?: number; } declare interface FormValues { srcChainId: string; srcDenom: string; dstChainId: string; dstDenom: string; quantity: string; sender: string; cosmosWalletName?: string; recipient: string; slippagePercent: string; } export declare const initiaPrivyWallet: () => Wallet; export declare const initiaPrivyWalletConnector: CreateConnectorFn< { on: (event: event, listener: EIP1193EventMap[event]) => void; removeListener: (event: event, listener: EIP1193EventMap[event]) => void; request: EIP1193RequestFn; }, Record, Record>; export declare const initiaPrivyWalletOptions: { id: string; name: string; iconUrl: string; iconBackground: string; }; export declare function injectStyles(css: string): void; export declare const InterwovenKit: ({ bridge }: { bridge?: Partial; }) => JSX.Element; export declare const InterwovenKitProvider: ({ children, ...config }: PropsWithChildren>) => JSX.Element | null; export declare const MAINNET: Config; export declare class MoveError extends Error { originalError: Error; moduleAddress: string; moduleName: string; errorCode: string; errorCodeHex: string; isFromRegistry: boolean; constructor(message: string, originalError: Error, moduleAddress: string, moduleName: string, errorCode: string, errorCodeHex: string, isFromRegistry: boolean); } declare class OfflineSigner implements OfflineAminoSigner { private address; private signMessage; private restUrl; constructor(address: string, signMessage: (message: string) => Promise, restUrl: string); private cachedPublicKey; private setCachedPublicKey; private getCachedPublicKey; private getPublicKeyFromRestApi; private getPublicKey; getAccounts(): Promise; signAmino(signerAddress: string, signDoc: StdSignDoc): Promise; } /** Initial editable values for the buy-with-cash form. */ declare interface OnrampPreset { /** Non-negative fiat amount with at most two decimal places, e.g. "40". */ amount: string; /** ISO currency code, matched case-insensitively, e.g. "USD". */ currency: string; } declare interface PortfolioAssetGroup extends PortfolioAssetGroupInfo { assets: Array; totalValue: number; totalAmount: number; } declare interface PortfolioAssetGroupInfo { symbol: string; logoUrl: string; } declare interface PortfolioAssetItem extends PortfolioAssetGroupInfo { amount: string; denom: string; decimals: number; quantity: string; price?: number; value?: number; address?: string; unlisted?: boolean; chain: PortfolioChainInfo; } declare interface PortfolioChainInfo { chainId: string; name: string; logoUrl: string; } declare interface PortfolioChainItem extends PortfolioChainInfo { value: number; } export declare const PRIVY_APP_ID = "cmbq1ozyc006al70lx4uciz0q"; export declare const TESTNET: Config; declare interface TxParams { messages: EncodeObject[]; memo?: string; chainId?: string; fee: StdFee; preferredFeeDenom?: string; } declare interface TxRequest { messages: EncodeObject[]; memo?: string; chainId?: string; gas?: number; gasAdjustment?: number; gasPrices?: Coin[] | null; spendCoins?: Coin[]; /** Internal use only */ internal?: boolean | string | number; } export declare function useAddress(): string; export declare function useHexAddress(): string; export declare function useInitiaAddress(): string; export declare function useInterwovenKit(): { estimateGas: ({ messages, memo, chainId }: TxRequest) => Promise; simulateTx: ({ messages, memo, chainId }: TxRequest) => Promise; requestTxSync: (txRequest: TxRequest) => Promise; requestTxBlock: (txRequest: TxRequest, timeoutMs?: number, intervalMs?: number) => Promise; submitTxSync: (txParams: TxParams) => Promise; submitTxBlock: (txParams: TxParams, timeoutMs?: number, intervalMs?: number) => Promise; waitForTxConfirmation: ({ chainId, ...params }: { txHash: string; chainId?: string; timeoutMs?: number; intervalMs?: number; }) => Promise; address: string; initiaAddress: string; hexAddress: string; username: string | null | undefined; offlineSigner: OfflineSigner; isConnected: boolean; isOpen: boolean; openConnect: () => void; openWallet: () => void; openBridge: (defaultValues?: Partial) => void; openDeposit: (params: { denoms: string[]; chainId?: string; srcOptions?: AssetOption[]; recipientAddress?: string; onramp?: OnrampPreset; }) => void; openWithdraw: (params: { denoms: string[]; chainId?: string; dstOptions?: AssetOption[]; recipientAddress?: string; }) => void; disconnect: () => void; autoSign: { isLoading: boolean; enable: (chainId?: string, options?: EnableAutoSignOptions) => Promise; disable: (chainId?: string) => Promise; expiredAtByChain: Record; isEnabledByChain: Record; granteeByChain: Record; }; }; export declare function usePortfolio(): { isLoading: boolean; refetch: () => void; chainsByValue: PortfolioChainItem[]; assetGroups: PortfolioAssetGroup[]; unlistedAssets: PortfolioAssetItem[]; totalValue: number; }; export declare function useUsernameQuery(address?: string): UseQueryResult; export { }