export { C as CachedAssertion, g as generatePasskeyUserId } from '../passkey-cache-WnDFQ-v4.js'; export { a as PasskeyFormFactor, P as PasskeyMetadata, b as PasskeyMetadataInput, f as formatPasskeyLabel, r as resolvePasskeyMetadata } from '../passkey-metadata-QqFF2SWQ.js'; import { Address, Hex } from 'viem'; import { ChainEntry, ChainConfigItem, Chain, BitcoinChainEntry, EvmChainEntry, TronChainEntry, SolanaChainEntry, BitcoinUtxo, WalletChain, BitcoinAddressType } from '../types/index.js'; import { SiweMessage } from 'siwe'; /** * Tiny in-memory store for the login OTP currently in flight. * Singleton: the SDK creates exactly one and uses it to remember the email * between `sendCode` and `loginWithCode`, or the SMS challenge between * `sendSmsCode` and `loginWithSmsCode`. */ declare class AuthenticationState { private email; private smsChallengeId; setEmail(email: string): void; getEmail(): string | null; clearEmail(): void; setSmsChallengeId(challengeId: string): void; getSmsChallengeId(): string | null; clearSmsChallengeId(): void; clear(): void; } declare const authState: AuthenticationState; /** * Sanitize user data to only include public profile information. * Removes session-related fields to match the response from verifyIdToken. * * @param userData - Raw user data that may contain session information * @returns Public user object safe for provider state */ declare function sanitizeUserData(userData: any): any; /** * Verify ID token with MoonX API and retrieve user info. */ interface VerifyIdTokenResponse { success: boolean; user?: any; error?: string; statusCode?: number; } declare const verifyIdToken: (publishableKey: string, idToken: string) => Promise; declare const fromB64url: (b64url: string) => Uint8Array; declare const toB64url: (bytes: Uint8Array) => string; declare const KERNEL_V3_3_7702: Address; declare const ATOMIC_BATCH_DELEGATES: Readonly>; declare const MAX_ATOMIC_BATCH_CALLS = 20; interface AtomicBatchCall { to: string; value?: string | number | bigint; data?: string; } declare const ERC7579_BATCH_MODE: Hex; declare const encodeAtomicBatch: (calls: readonly AtomicBatchCall[]) => Hex; declare function getEvmCode(rpcUrl: string, address: string): Promise; declare function getEvmChainId(rpcUrl: string): Promise; declare const delegationTarget: (code: string) => Address | null; declare function getEvmFees(rpcUrl: string): Promise<{ maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; }>; declare function estimateAtomicBatchGas(rpcUrl: string, from: string, calls: readonly AtomicBatchCall[], includesAuthorization: boolean): Promise; /** * Chain utilities for MoonX */ /** * Get the RPC URL for a chain * @param chain - The chain to get the RPC URL for * @returns The HTTP RPC URL */ declare function getRpcUrl(chain: Chain): string; /** * Call `eth_maxPriorityFeePerGas` against an EVM RPC. Returns the * chain's current recommended priority-fee (tip) as a bigint (wei). * * Asking the chain itself sidesteps per-chain network-enforced tip * floors — Polygon, for example, rejects txs below 25 gwei with * `gas tip cap below minimum`. * * Not all RPCs expose this method; callers should treat a thrown * error as "use a fallback". */ declare function getEvmMaxPriorityFeePerGas(rpcUrl: string): Promise; /** * Call `eth_gasPrice` against an EVM RPC. Returns the chain's current * legacy gas price as a bigint (wei). Used by useSendTransaction to * size sensible EIP-1559 maxFeePerGas / maxPriorityFeePerGas values * per chain — without this, hardcoded mainnet defaults (22 gwei) blow * past the balance check on L2s where real prices are sub-gwei. */ declare function getEvmGasPrice(rpcUrl: string): Promise; /** * Call `eth_estimateGas` against an EVM RPC for the given tx. Used by * useSendTransaction to fill in `gas` when the caller doesn't provide * it. Throws on RPC error / would-revert; the caller is expected to * fall back to a generous default. */ declare function estimateEvmGas(rpcUrl: string, tx: { from: string; to?: string; data?: string; value?: string | number | bigint; }): Promise; /** * Call `eth_getTransactionCount` with `pending` block tag against an * EVM RPC. Returns the next nonce a wallet should use, including any * txs the user has already broadcast but that haven't been mined yet. * * Used by useSendTransaction to fill `nonce` when the caller doesn't * supply one. Critical for back-to-back sends (approve → swap, etc.) * — without this the downstream serializer leaves nonce undefined and * viem defaults it to 0, so any tx after the wallet's first lands as * `nonce too low: next nonce N, tx nonce 0` at the RPC. * * Reading from the same `rpcUrl` we'll later broadcast against keeps * the read and write internally consistent — separate viem public * clients elsewhere can hit different load-balanced nodes and return * a count that's a block stale relative to the broadcast endpoint. */ declare function getEvmNonce(rpcUrl: string, address: string): Promise; /** * Estimate the user's pre-flight native-fee reserve for a swap on * this chain: `gas units × eth_gasPrice × bufferBps / 10000`, returned * in human units (ETH / POL / BNB — all 18-decimal natives). * * The default 1.5x cushion mirrors the SDK's max-fee auto-fill so the * reserve covers `balance >= value + gas × maxFeePerGas` even when * gas drifts between estimation and inclusion. Reads `eth_gasPrice` * from the same RPC the SDK broadcasts to. */ declare function estimateEvmGasReserve(rpcUrl: string, chainId: number, opts?: { gasUnits?: bigint; bufferBps?: number; }): Promise; /** * Find a viem `Chain` by its numeric chain ID. * * Accepts the unified `ChainConfigItem[]` shape: each element may be a bare * viem `Chain`, an `{ chain, rpcUrl? }` EVM entry, or a Solana entry. The id * lives on `chain.id` for entry-form items, so we normalize before comparing * — a plain `item.id` check would miss every `{ chain }` entry (the documented * override shape). Solana entries (string id) never match a numeric chainId. */ declare function getChainById(chains: ChainConfigItem[], chainId: number): Chain | undefined; /** * Check if a numeric chain ID is configured. Handles the unified * `ChainConfigItem[]` shape (see `getChainById`). */ declare function isChainSupported(chains: ChainConfigItem[], chainId: number): boolean; /** Type guard: is this normalized entry an EVM entry (carries a viem Chain)? */ declare function isEvmEntry(entry: ChainEntry): entry is EvmChainEntry; /** Type guard: a string-id entry in the "tron" namespace (e.g. "tron:mainnet"). */ declare function isTronEntry(entry: ChainEntry): entry is TronChainEntry; /** Type guard: a string-id entry in the "bitcoin" namespace. */ declare function isBitcoinEntry(entry: ChainEntry): entry is BitcoinChainEntry; /** * Coerce a `ChainConfigItem` to its normalized form. A bare viem `Chain` * (numeric `id`) becomes an `EvmChainEntry`; `{ chain, … }` is already one; * anything else is one of the explicit string-id chain entries. */ declare function normalizeChainItem(item: ChainConfigItem): ChainEntry; /** Canonical CAIP-2 id for a normalized entry. */ declare function entryCaip2(entry: ChainEntry): string; interface ChainIndex { /** Normalized entries in declaration order. */ entries: ChainEntry[]; /** Normalized alias key -> entry (first declaration wins on collision). */ byAlias: Map; } /** * Normalize a chain reference to its alias-lookup key. Numbers → `eip155:`. * * Throws a clear error on anything that isn't a string or number — most often * an old-shape viem `Chain` object passed where a reference is now expected * (e.g. `defaultChain: mainnet`). Without this guard the bare `.trim()` below * would surface an opaque `TypeError`. */ declare function normalizeChainKey(key: string | number): string; /** Normalize every element and build the alias→entry index. */ declare function buildChainIndex(chains?: ChainConfigItem[]): ChainIndex; /** * Resolve a chain entry from the config by selector (alias | CAIP-2 | numeric * chainId | Solana id). With no selector, falls back to `defaultSelector`, then * to the first configured chain. Returns undefined when nothing matches. */ declare function resolveChainEntry(chains: ChainConfigItem[] | undefined, selector?: string | number, defaultSelector?: string | number): ChainEntry | undefined; /** * Resolve a SOLANA entry, honoring (highest priority first): per-call * `selector` → `defaultSelector` (`config.defaultChain`, when it points at a * Solana cluster) → first configured Solana entry. This mirrors the EVM hooks * and the documented precedence — rather than hardcoding `solana:mainnet`. * * Constrained to non-EVM entries so a Solana operation can never resolve an * Ethereum chain: any selector (per-call or default) that matches an EVM alias * (e.g. `8453` / `"eip155:8453"` / `"eth:base"`) is ignored rather than handing * back an EVM HTTP RPC. An explicit `selector` that doesn't resolve to a Solana * entry returns `undefined` (no fall-through) — fails closed, so the Solana * hooks throw a clear "no RPC URL" error. */ declare function resolveSolanaChainEntry(chains: ChainConfigItem[] | undefined, selector?: string | number, defaultSelector?: string | number): SolanaChainEntry | undefined; /** * Resolve a TRON entry, mirroring `resolveSolanaChainEntry`'s precedence and * fail-closed semantics: an explicit selector that doesn't name a configured * tron entry returns undefined rather than falling through to another chain. */ declare function resolveTronChainEntry(chains: ChainConfigItem[] | undefined, selector?: string | number, defaultSelector?: string | number): TronChainEntry | undefined; /** * Resolve a BITCOIN entry with the same fail-closed selector semantics as the * Solana and Tron resolvers. */ declare function resolveBitcoinChainEntry(chains: ChainConfigItem[] | undefined, selector?: string | number, defaultSelector?: string | number): BitcoinChainEntry | undefined; /** * Resolve the EVM entry to use, honoring (highest priority first): * per-call `selector` → tx `requestedChainId` → `walletChainId` → * `defaultSelector` → first EVM entry. * * Crucially, an EXPLICIT input (`selector` or `requestedChainId`) must resolve * to a configured EVM chain — if one is provided but doesn't match, this * returns `undefined` WITHOUT silently falling back to the wallet chain / * default / first entry. A caller that named a network it didn't configure * must hear about it (the hooks turn this into a clear error), rather than * having the send/read quietly run on a different chain. Implicit sources * (`walletChainId`, `defaultSelector`, first entry) are consulted only when no * explicit input is given. */ declare function resolveEvmChainEntry(opts: { chains?: ChainConfigItem[]; selector?: string | number; requestedChainId?: number; walletChainId?: number; defaultSelector?: string | number; }): EvmChainEntry | undefined; /** * Resolve the HTTP RPC URL for an entry. An explicit `override` (per-call * `rpcUrl`) always wins; otherwise the entry's `rpcUrl`, then the viem chain's * built-in default (EVM only). */ declare function resolveRpcUrl(entry: ChainEntry, override?: string): string; /** Resolve the WebSocket URL for an entry, with the same override precedence. */ declare function resolveWsUrl(entry: ChainEntry, override?: string): string | undefined; /** * Validate the unified chain config. Throws on an empty `chains` array, * duplicate canonical ids, a Solana entry missing its `rpcUrl`, or a * `defaultChain` that doesn't reference a configured chain. */ declare function validateChainConfig(config: { chains?: ChainConfigItem[]; defaultChain?: string | number; }): void; interface EthereumSiweMessageProps { nonce: string; domain: string; address: string; uri?: string; version?: string; chainId?: number; statement?: string; issuedAt?: string; expirationTime?: string; notBefore?: string; requestId?: string; resources?: string[]; } interface ManualSiweMessageProps { nonce: string; domain: string; address: string; uri?: string; version?: string; chainId?: number; statement?: string; issuedAt?: string; walletName?: string; } declare class EthereumSiweMessage { private siweMessage; constructor({ nonce, domain, address, uri, version, chainId, statement, issuedAt, expirationTime, notBefore, requestId, resources }: EthereumSiweMessageProps); prepareMessage(): string; getMessage(): SiweMessage; } declare function createManualSiweMessage({ nonce, domain, address, uri, version, chainId, statement, issuedAt, walletName }: ManualSiweMessageProps): string; /** Loose input transaction — accepts every shape callers throw at it. */ interface EvmTransactionInput { to?: string; value?: string | number | bigint; nonce?: string | number | bigint; gasLimit?: string | number | bigint; gas?: string | number | bigint; gasPrice?: string | number | bigint; data?: string; chainId?: number; type?: number | "legacy" | "eip2930" | "eip1559"; maxPriorityFeePerGas?: string | number | bigint; maxFeePerGas?: string | number | bigint; } /** Minimal wallet shape `tx-prep` needs (avoids reaching for full PublicWallet). */ interface EvmTxPrepWallet { public_address: string; chainId?: number; } interface ChainResolutionInput { /** Unified chain config (`config.chains`). */ chains?: ChainConfigItem[]; /** Per-call chain selector (`params.chain`): alias | CAIP-2 | numeric id. */ chainSelector?: string | number; /** Pull from the input transaction's `chainId` if the caller was explicit. */ requestedChainId?: number; /** Wallet's bound chain, if any. */ walletChainId?: number; /** Provider-level default chain reference (`config.defaultChain`). */ defaultChain?: string | number; /** Per-call inline `rpcUrl` override. */ rpcUrlOverride?: string; /** * When true, reject if an explicit requested chain isn't configured. * Sign-only paths leave this false (best-effort fallback to default). * Send paths set it true so a Base tx never silently broadcasts to mainnet. */ strict?: boolean; } /** * Resolve which chain (and RPC URL) to use for the operation. * * Priority: per-call `chainSelector` → tx `requestedChainId` → * `walletChainId` → `defaultChain` → first configured EVM chain. * * Explicit selections are honored exactly — they never silently degrade to a * different chain: * - An explicit `chainSelector` that isn't configured ALWAYS throws (the * caller named a network that doesn't exist), even if an `rpcUrlOverride` * is present — a one-off override is addressed by `requestedChainId`, not * by a chain alias. * - An explicit `requestedChainId` that isn't configured does NOT fall back * to the wallet / default chain. With an `rpcUrlOverride` it becomes a * one-off: the tx serializes against `requestedChainId` and broadcasts via * the override (so a Polygon tx never gets rewritten to mainnet's id). * Without an override it throws under `strict`, or falls through to * implicit resolution on the sign path (`strict: false`). * * An `rpcUrlOverride` overrides the transport for whichever chain is resolved. */ declare function resolveEvmChain({ chains, chainSelector, requestedChainId, walletChainId, defaultChain, rpcUrlOverride, strict, }: ChainResolutionInput): { chain: Chain; rpcUrl: string; }; /** * Sign-path prep. Converts an input transaction (string or object) into * the serialized RLP string the iframe-side signer expects. Handles * value/fee parsing (bigint, hex, decimal-ether) and gas-type branching. * * No RPC calls — caller can sign now and broadcast later. Returns the * resolved chain too so the hook can stash it if needed. */ declare function prepareEvmSignTransaction({ transaction, wallet, chains, defaultChain, chainSelector, }: { transaction: string | EvmTransactionInput; wallet: EvmTxPrepWallet; chains?: ChainConfigItem[]; defaultChain?: string | number; chainSelector?: string | number; }): Promise<{ serializedTransaction: string; chain: Chain | undefined; }>; /** * Send-path prep. Resolves the broadcast chain + RPC URL, then * auto-fills missing nonce, gas, and EIP-1559 fee fields from the * chain itself. Returns the prepared transaction object (NOT * serialized — the iframe-side signer re-serializes after signing) * along with the chain and RPC URL. * * Auto-fill behavior: * - nonce: `eth_getTransactionCount(addr, "pending")`. Critical for * back-to-back sends; without it viem defaults to nonce=0 and the * second tx of any session is rejected as "nonce too low." * - gas: `eth_estimateGas` with a 20% safety buffer; falls back to * 800k if estimation fails (would-revert tx, RPC hiccup) so the * user gets a real on-chain failure rather than "intrinsic gas too * low" at the mempool. * - EIP-1559 fees: `eth_gasPrice` + `eth_maxPriorityFeePerGas`. Tip * gets a 20% bump for inclusion safety; maxFee floors at tip + 1 * wei so the chain doesn't reject `maxFee < tip`. Emits hex (wei) * because the downstream serializer treats plain decimal strings * as gwei. * * RPC hiccups are swallowed deliberately: leave the field unset and * let the downstream serializer handle it. The caller gets a clearer * error from the chain than a silent stuck tx. */ declare function prepareEvmSendTransaction({ transaction, wallet, chains, defaultChain, chainSelector, rpcUrlOverride, }: { transaction: EvmTransactionInput; wallet: EvmTxPrepWallet; chains?: ChainConfigItem[]; defaultChain?: string | number; chainSelector?: string | number; rpcUrlOverride?: string; }): Promise<{ transaction: EvmTransactionInput; rpcUrl: string; chain: Chain; }>; interface SiwsMessageProps { nonce: string; domain: string; address: string; uri?: string; version?: string; chainId?: string; statement?: string; issuedAt?: string; expirationTime?: string; notBefore?: string; requestId?: string; resources?: string[]; message?: string; signature?: string; } declare class SiwsMessage { nonce: string; domain: string; address: string; uri?: string; version?: string; chainId?: string; statement?: string; issuedAt?: string; expirationTime?: string; notBefore?: string; requestId?: string; resources?: string[]; message?: string; signature?: string; constructor({ nonce, domain, address, uri, version, chainId, statement, issuedAt, expirationTime, notBefore, requestId, resources, message, signature }: SiwsMessageProps); prepareBasic(): Uint8Array; prepareAdvanced(): Uint8Array; token(signature: Uint8Array): Promise; decode(token: string): SiwsMessage; validate(): Promise; } interface DetailedInstruction { type: string; details: Record; } declare class SolanaTransactionParser { private logs; private wireTransaction?; private instructions; constructor(logs: string[], base64Transaction?: string, _connection?: unknown, _userPublicKey?: unknown); parse(): Promise; private parseWire; private parseInstruction; private parseGenericInstruction; private parseComputeBudget; private parseAssociatedToken; private parseSystemProgram; private parseTokenProgram; private parseJupiterBasic; private parseTokenAccountData; private formatTokenAmount; private formatSOL; private truncate; getInstructions(): DetailedInstruction[]; getInstructionsByType(type: string): DetailedInstruction[]; } declare function getInstructionsForHTML(base64Transaction: string, logs: string[], _connection?: unknown, _userPublicKey?: unknown): Promise; }>>; declare function getTransferInfoFromInstructions(base64Transaction: string, logs: string[], solPriceUsd?: string): Promise>; declare function getSOLTransfersFromInstructions(base64Transaction: string, logs: string[], solPriceUsd?: string): Promise>; interface SolanaBalanceChange { /** "SOL" for the wallet's lamports, otherwise the token's mint address. */ asset: string; /** Signed amount in whole units, e.g. "-0.5", "+1". */ amount: string; decimals: number; /** One unit of a zero-decimal mint: almost always an NFT. */ nft: boolean; } /** Authority the signer hands out. Balances don't change until it's used. */ type SolanaPreviewWarning = /** SPL Approve: `delegate` may move up to `amount` (base units) out of `account`. */ { kind: "delegate"; account: string; delegate?: string; amount: string; /** u64 max, as dApps send for an "unlimited" approval. */ unlimited: boolean; mint?: string; decimals?: number; } /** SPL SetAuthority over a token account or mint; `to` null removes it. */ | { kind: "authority"; account?: string; to: string | null; } /** System Assign: the signer's own account goes to `program`. */ | { kind: "assign"; program: string; }; interface SolanaTransactionPreview { /** False when the simulation failed: the transaction would likely fail. */ ok: boolean; /** Why the simulation failed, from the runtime error and program logs. */ error?: string; /** Net changes to the signer's balances, network fee included. */ changes: SolanaBalanceChange[]; /** Network fee in lamports, when the signer pays it and the RPC knows it. */ feeLamports?: number; /** Another account (usually the dApp) pays the network fee. */ feePaidByOther: boolean; warnings: SolanaPreviewWarning[]; /** Lookup tables couldn't be loaded, so some changes may be missing. */ incomplete: boolean; } interface ParsedMessage { feePayer: string; /** Writable static account keys, fee payer first. */ writable: string[]; staticKeys: string[]; lookups: Array<{ table: string; writableIndexes: number[]; readonlyIndexes: number[]; }>; instructions: Array<{ programIdIndex: number; accountKeyIndexes: number[]; data: Uint8Array; }>; /** Base64 of the message bytes, for getFeeForMessage. */ messageBase64: string; } /** Static account keys and fee payer of a legacy, v0 or v1 wire transaction. */ declare const parseSolanaMessage: (transaction: Uint8Array) => ParsedMessage; /** `post - pre` base units as a signed decimal string in whole units. */ declare const formatUnitsDelta: (delta: bigint, decimals: number) => string; declare const previewSolanaTransaction: ({ rpcUrl, transaction, owner, fetchFn, }: { rpcUrl: string; /** Wire bytes, signed or not. */ transaction: Uint8Array; /** The signing wallet's address. */ owner: string; fetchFn?: typeof fetch; }) => Promise; /** * Throws `message_is_transaction` when the bytes a Solana signMessage would * sign (`messageHex`, else the UTF-8 of `message`) are a transaction * message: the signature would be valid for that transaction. Throws * `invalid_message_hex` for hex the iframe can't decode. Run before the * passkey prompt; the iframe refuses both too. */ declare const assertSignableSolanaMessage: (message: string, messageHex?: string) => void; /** * Derive the base58check Tron address from a secp256k1 public key * (compressed or uncompressed hex, with or without 0x): * keccak256(uncompressed pubkey body)[12:] prefixed with 0x41, then * base58check (double-sha256 checksum). * * Async for API compatibility; the derivation itself is synchronous. */ declare function tronAddressFromPublicKey(publicKeyHex: string): Promise; /** * Decode raw_data_hex (the signed bytes) into a labeled preview object. * Throws on malformed input - callers fall back to showing the raw * payload rather than a possibly-wrong decode. */ declare function decodeTronRawData(rawDataHex: string): Promise>; type BitcoinNetwork = "mainnet" | "testnet" | "regtest"; /** Plain Base58 (Bitcoin alphabet, no checksum). */ declare const base58Encode: (value: Uint8Array) => string; /** Encode a raw secp256k1 scalar as compressed Wallet Import Format. */ declare const bitcoinPrivateKeyToWif: (privateKey: string | Uint8Array, network?: BitcoinNetwork) => string; /** Decode a compressed WIF and return the raw 32-byte scalar as hex. */ declare const bitcoinPrivateKeyFromWif: (wif: string, network?: BitcoinNetwork) => string; /** Accept the backwards-compatible raw hex form or compressed WIF. */ declare const normalizeBitcoinPrivateKey: (privateKey: string, network?: BitcoinNetwork) => string; declare const normalizeXOnlyPublicKey: (publicKey: string | Uint8Array) => Uint8Array; /** BIP-341 key-path-only tagged hash: hash_TapTweak(xOnlyInternalKey). */ declare const bitcoinTapTweak: (internalPublicKey: string | Uint8Array) => Uint8Array; /** Apply the BIP-341 key-path tweak locally, using lift_x's even-Y point. */ declare const bitcoinTaprootOutputKey: (internalPublicKey: string | Uint8Array) => Uint8Array; declare const bitcoinInternalPublicKeyFromPrivateKey: (privateKey: string | Uint8Array) => Uint8Array; /** Return the canonical compressed secp256k1 public key used by P2WPKH. */ declare const bitcoinCompressedPublicKey: (publicKey: string | Uint8Array) => Uint8Array; /** Encode a compressed secp256k1 public key as a native P2WPKH address. */ declare const bitcoinP2wpkhAddress: (publicKey: string | Uint8Array, network?: BitcoinNetwork) => string; /** Encode a compressed secp256k1 public key as a legacy P2PKH address. */ declare const bitcoinP2pkhAddress: (publicKey: string | Uint8Array, network?: BitcoinNetwork) => string; declare const bitcoinAddressTypeFromAddress: (walletAddress: string) => "p2tr" | "p2wpkh" | "p2pkh"; /** * Identify which network an address was actually encoded for. The single * source of truth for "what network is this wallet on" — callers MUST use * this instead of trusting a caller-supplied network option, which would let * an integrator claim testnet for a mainnet wallet (or vice versa) and get a * mismatched preview/signing context. * * Legacy (P2PKH) testnet and regtest addresses share the same version byte * and are genuinely indistinguishable from the address alone; they both * resolve to "testnet" here. */ declare const bitcoinNetworkFromAddress: (walletAddress: string) => BitcoinNetwork; /** Reject unsupported Bitcoin wallet networks before authorization or key access. */ declare const assertBitcoinMainnetWallet: (walletAddress: string, network?: BitcoinNetwork) => void; /** Encode an already-tweaked BIP-341 output key as a native P2TR address. */ declare const bitcoinP2trAddress: (outputPublicKey: string | Uint8Array, network?: BitcoinNetwork) => string; declare const bitcoinPublicKeyHex: (publicKey: string | Uint8Array) => string; /** Read a confirmed address balance through Blockbook's JSON-RPC extension. */ declare const getBitcoinAddressBalance: (rpcUrl: string, walletAddress: string, network?: BitcoinNetwork) => Promise<{ balanceBaseUnit: string; balanceNativeUnit: string; walletAddress: string; network: BitcoinNetwork; }>; /** List spendable address UTXOs through Blockbook's JSON-RPC extension. */ declare const getBitcoinUtxos: (rpcUrl: string, walletAddress: string, confirmed?: boolean) => Promise; /** Broadcast finalized raw Bitcoin transaction hex through Blockbook. */ declare const broadcastBitcoinSigned: (rpcUrl: string, transactionHex: string) => Promise; interface BuildUrlConfig { publishableKey: string; config?: { appearance?: { hideClose?: boolean; }; }; } declare const buildUrl: (baseUrl: string, sdkConfig: BuildUrlConfig, enableCaptcha?: boolean, captchaSitekey?: string) => string; declare const DEFAULT_AUTH_URL = "https://x-iframe.moonpay.com"; declare const serializeEthereumTransaction: (transaction: any) => Promise; declare const broadcastEthereumRaw: (rpcUrl: string, signedSerialized: string) => Promise; declare const broadcastSolanaSigned: (rpcUrl: string, signedBase58: string) => Promise; /** * Broadcast a signed Tron transaction (TronWeb JSON shape, signature * attached) to a fullnode. Returns the txid. Tron reports failures as * `{ result: false, code, message }` with `message` hex-encoded ASCII; * decode it so callers see "Contract validate error: ..." instead of hex. */ declare const broadcastTronSigned: (rpcUrl: string, signedTransaction: { txID: string; } & Record) => Promise; /** * Canonical algorithm name written to `app_user_wallet_keyshares.algorithm`. * * Matches Sodot's Vertex API path segment exactly: * * ethereum → "ecdsa" * tron → "ecdsa" * solana → "exportable-ed25519" * bitcoin P2TR → "bip340" * bitcoin P2WPKH/P2PKH → "ecdsa" * * `Algorithm.name.toLowerCase()` from the Sodot SDK would give * `"exportableed25519"` (no hyphen) for Solana, which doesn't match * anything else in the stack and causes sign dispatch to fall through * to the default error branch. Use this helper instead. */ declare function canonicalAlgorithmFor(chain: WalletChain, addressType?: BitcoinAddressType): string; /** * Parse the canonical SES wire form of a derivation path into the * integer array the Sodot MPC client expects. * * "m" → [] (root — imports + all * exportable-ed25519 wallets) * "m/44/60/0/0/0" → [44, 60, 0, 0, 0] * "" → [] (legacy fallback; same as "m") * * Stays byte-for-byte identical to the Go-side `ParseDerivationPath` * in `apps/wallets/internal/service/wallet.go` — both halves of the * MPC ceremony have to agree on the path or Sodot returns "End-to-end * decryption failed" with no further hint as to which input mismatched. */ declare function parseDerivationPath(path: string): Uint32Array; /** * Convert any wire representation of a byte array back into Uint8Array. * Pass-through for actual `Uint8Array` and regular `number[]`. Used * defensively at every transport boundary that may have stripped typed * arrays. */ declare const arrayLikeToBytes: (value: unknown) => Uint8Array; /** * Decode a base58 string (or pass-through bytes) into Uint8Array. * Solana sign-transaction handlers return base58-encoded signed bytes; * sign-message handlers return raw Uint8Array. This helper handles * both shapes so callers don't have to branch. * * `bs58` is an optional peer of `@moon-x/core`; we lazy-import to keep * the cold-start lean for consumers who don't use Solana flows. */ declare const bs58ToBytes: (value: unknown) => Promise; /** Structural WalletConnect v2 types so platform SDKs can share headless * session logic without making @walletconnect/sign-client a core dependency. */ interface WalletConnectNamespace { accounts: string[]; methods: string[]; events: string[]; chains?: string[]; } interface WalletConnectSessionLike { topic: string; namespaces: Record; peer?: { metadata?: { name?: string; description?: string; url?: string; icons?: string[]; }; }; } interface WalletConnectClientLike { connect(options: { requiredNamespaces: Record; optionalNamespaces?: Record; }): Promise<{ uri?: string; approval: () => Promise; }>; request(options: { topic: string; chainId: string; request: { method: string; params: unknown; }; }): Promise; disconnect(options: { topic: string; reason: { code: number; message: string; }; }): Promise; session?: { getAll(): WalletConnectSessionLike[]; }; on?: (event: string, listener: (payload: any) => void) => void; off?: (event: string, listener: (payload: any) => void) => void; } interface WalletConnectAccount { namespace: string; chainId: string; address: string; caip10: string; } declare const parseWalletConnectAccount: (caip10: string) => WalletConnectAccount | null; declare const getWalletConnectAccounts: (session: WalletConnectSessionLike) => WalletConnectAccount[]; declare const beginWalletConnectSession: (client: WalletConnectClientLike, options: Parameters[0]) => Promise<{ uri?: string; approval: () => Promise; }>; declare const requestWalletConnect: (client: WalletConnectClientLike, params: { topic: string; chainId: string; method: string; requestParams: unknown; }) => Promise; declare const disconnectWalletConnectSession: (client: WalletConnectClientLike, topic: string) => Promise; /** * Guard the browser SDKs' `publishableKey` slot against a secret key. * * Publishable keys (`moon_pk_*`) are meant to ship in frontend code; secret * keys (`moon_sk_*`) must never reach a browser. If a developer copy-pastes the * wrong env var into ``, fail loudly at mount — * before any iframe / WebView loads — rather than shipping the secret to every * visitor. Mirrors the Node SDK's inverse guard (reject `moon_pk_*` in the * secret-key slot) and Stripe's pk/sk symmetry. * * Deliberately narrow: it ONLY rejects the secret-key prefix. A placeholder, * typo, or otherwise-invalid string that isn't secret-shaped flows through to * the existing API-key middleware rejection — this guard exists solely to catch * the "shipped my secret to the browser" footgun, not to validate key format. * A missing / non-string value is likewise left alone so the downstream * "publishable key required" path keeps ownership of that error. * * @throws {Error} when `publishableKey` starts with `moon_sk_`. */ declare function validatePublishableKey(publishableKey: string): void; export { ATOMIC_BATCH_DELEGATES, type AtomicBatchCall, type BitcoinNetwork, type BuildUrlConfig, type ChainIndex, DEFAULT_AUTH_URL, ERC7579_BATCH_MODE, EthereumSiweMessage, type EthereumSiweMessageProps, type EvmTransactionInput, type EvmTxPrepWallet, KERNEL_V3_3_7702, MAX_ATOMIC_BATCH_CALLS, type ManualSiweMessageProps, SiwsMessage, type SolanaBalanceChange, type SolanaPreviewWarning, SolanaTransactionParser, type SolanaTransactionPreview, type VerifyIdTokenResponse, type WalletConnectAccount, type WalletConnectClientLike, type WalletConnectNamespace, type WalletConnectSessionLike, arrayLikeToBytes, assertBitcoinMainnetWallet, assertSignableSolanaMessage, authState, base58Encode, beginWalletConnectSession, bitcoinAddressTypeFromAddress, bitcoinCompressedPublicKey, bitcoinInternalPublicKeyFromPrivateKey, bitcoinNetworkFromAddress, bitcoinP2pkhAddress, bitcoinP2trAddress, bitcoinP2wpkhAddress, bitcoinPrivateKeyFromWif, bitcoinPrivateKeyToWif, bitcoinPublicKeyHex, bitcoinTapTweak, bitcoinTaprootOutputKey, broadcastBitcoinSigned, broadcastEthereumRaw, broadcastSolanaSigned, broadcastTronSigned, bs58ToBytes, buildChainIndex, buildUrl, canonicalAlgorithmFor, createManualSiweMessage, decodeTronRawData, delegationTarget, disconnectWalletConnectSession, encodeAtomicBatch, entryCaip2, estimateAtomicBatchGas, estimateEvmGas, estimateEvmGasReserve, formatUnitsDelta, fromB64url, getBitcoinAddressBalance, getBitcoinUtxos, getChainById, getEvmChainId, getEvmCode, getEvmFees, getEvmGasPrice, getEvmMaxPriorityFeePerGas, getEvmNonce, getInstructionsForHTML, getRpcUrl, getSOLTransfersFromInstructions, getTransferInfoFromInstructions, getWalletConnectAccounts, isBitcoinEntry, isChainSupported, isEvmEntry, isTronEntry, normalizeBitcoinPrivateKey, normalizeChainItem, normalizeChainKey, normalizeXOnlyPublicKey, parseDerivationPath, parseSolanaMessage, parseWalletConnectAccount, prepareEvmSendTransaction, prepareEvmSignTransaction, previewSolanaTransaction, requestWalletConnect, resolveBitcoinChainEntry, resolveChainEntry, resolveEvmChain, resolveEvmChainEntry, resolveRpcUrl, resolveSolanaChainEntry, resolveTronChainEntry, resolveWsUrl, sanitizeUserData, serializeEthereumTransaction, toB64url, tronAddressFromPublicKey, validateChainConfig, validatePublishableKey, verifyIdToken };