{
  "version": 3,
  "sources": ["../src/clients/createClient.ts", "../src/clients/decorators/public.ts", "../src/clients/createPublicClient.ts", "../src/clients/decorators/wallet.ts", "../src/clients/createWalletClient.ts", "../src/clients/decorators/multisig.ts", "../src/clients/createMultiSigClient.ts", "../src/actions/wallet/nonceStores.ts", "../src/actions/wallet/nonceSources.ts", "../src/transports/http.ts", "../src/transports/custom.ts", "../src/transports/fallback.ts", "../src/transports/webSocket.ts"],
  "sourcesContent": [
    "import type { Client, ClientConfig } from \"./types.ts\";\n\nconst BASE_KEYS = new Set([\n\t\"chain\",\n\t\"account\",\n\t\"transport\",\n\t\"request\",\n\t\"nonceManager\",\n\t\"extend\",\n]);\n\nfunction bindExtend(base: Client): Client[\"extend\"] {\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\treturn ((fn: any) => {\n\t\tconst extensions = fn(base);\n\t\tconst next = { ...base };\n\t\tfor (const [key, value] of Object.entries(extensions)) {\n\t\t\tif (BASE_KEYS.has(key)) continue;\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\t\t(next as any)[key] = value;\n\t\t}\n\t\tnext.extend = bindExtend(next);\n\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\treturn next as any;\n\t}) as Client[\"extend\"];\n}\n\n/**\n * Create a base client with transport and optional chain/account.\n * Use `.extend()` to compose action decorators (public, wallet, multisig).\n */\nexport function createClient<\n\tTExtended extends Record<string, unknown> = Record<string, unknown>,\n>(config: ClientConfig): Client<TExtended> {\n\tconst transport = config.transport({ chain: config.chain });\n\n\tconst client: Client = {\n\t\tchain: config.chain,\n\t\taccount: config.account,\n\t\ttransport,\n\t\trequest: transport.request,\n\t\tnonceManager: config.nonceManager,\n\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\textend: null as any,\n\t};\n\n\tclient.extend = bindExtend(client);\n\n\treturn client as Client<TExtended>;\n}\n",
    "import {\n\ttype EstimateFeeParams,\n\ttype FeeEstimation,\n\testimateFee,\n} from \"../../actions/public/estimateFee.ts\";\nimport {\n\ttype AccountHistoryResponse,\n\ttype GetAccountHistoryParams,\n\tgetAccountHistory,\n} from \"../../actions/public/getAccountHistory.ts\";\nimport {\n\ttype AccountInfo,\n\ttype GetAccountInfoParams,\n\tgetAccountInfo,\n} from \"../../actions/public/getAccountInfo.ts\";\nimport {\n\ttype GetBalanceParams,\n\tgetBalance,\n} from \"../../actions/public/getBalance.ts\";\nimport {\n\ttype GetBlockParams,\n\tgetBlock,\n} from \"../../actions/public/getBlock.ts\";\nimport { getBlockHeight } from \"../../actions/public/getBlockHeight.ts\";\nimport {\n\ttype GetContractAbiParams,\n\tgetContractAbi,\n} from \"../../actions/public/getContractAbi.ts\";\nimport {\n\ttype ContractSourceResponse,\n\ttype GetContractSourceParams,\n\tgetContractSource,\n} from \"../../actions/public/getContractSource.ts\";\nimport {\n\ttype GetDataVarParams,\n\tgetDataVar,\n} from \"../../actions/public/getDataVar.ts\";\nimport {\n\ttype GetMapEntryParams,\n\tgetMapEntry,\n} from \"../../actions/public/getMapEntry.ts\";\nimport { getMempoolStats } from \"../../actions/public/getMempoolStats.ts\";\nimport {\n\ttype GetNftHoldingsParams,\n\ttype NftHoldingsResponse,\n\tgetNftHoldings,\n} from \"../../actions/public/getNftHoldings.ts\";\nimport {\n\ttype GetNonceParams,\n\tgetNonce,\n} from \"../../actions/public/getNonce.ts\";\nimport {\n\ttype GetRawBlockParams,\n\ttype RawBlockResponse,\n\tgetRawBlock,\n} from \"../../actions/public/getRawBlock.ts\";\nimport {\n\ttype GetTransactionParams,\n\tgetTransaction,\n} from \"../../actions/public/getTransaction.ts\";\nimport {\n\ttype MulticallParams,\n\ttype MulticallResult,\n\tmulticall,\n} from \"../../actions/public/multicall.ts\";\nimport {\n\ttype ReadContractParams,\n\treadContract,\n} from \"../../actions/public/readContract.ts\";\nimport {\n\ttype SimulateCallParams,\n\ttype SimulateCallResult,\n\tsimulateCall,\n} from \"../../actions/public/simulateCall.ts\";\nimport {\n\ttype SimulateTransactionParams,\n\ttype SimulateTransactionResult,\n\tsimulateTransaction,\n} from \"../../actions/public/simulateTransaction.ts\";\nimport type { TransactionReceipt } from \"../../actions/public/txSources.ts\";\nimport {\n\ttype WaitForTransactionReceiptParams,\n\twaitForTransactionReceipt,\n} from \"../../actions/public/waitForTransactionReceipt.ts\";\nimport type { ClarityValue } from \"../../clarity/types.ts\";\nimport {\n\ttype WatchAddressBalanceParams,\n\ttype WatchAddressParams,\n\ttype WatchBlocksParams,\n\ttype WatchMempoolParams,\n\ttype WatchNftEventParams,\n\ttype WatchTransactionParams,\n\twatchAddress,\n\twatchAddressBalance,\n\twatchBlocks,\n\twatchMempool,\n\twatchNftEvent,\n\twatchTransaction,\n} from \"../../subscriptions/actions.ts\";\nimport type { Subscription } from \"../../subscriptions/types.ts\";\nimport type { Client } from \"../types.ts\";\n\n/** Read-only actions: balance queries, contract reads, block data, and event subscriptions. */\nexport type PublicActions = {\n\tgetNonce: (params: GetNonceParams) => Promise<bigint>;\n\tgetBalance: (params: GetBalanceParams) => Promise<bigint>;\n\tgetAccountInfo: (params: GetAccountInfoParams) => Promise<AccountInfo>;\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\tgetBlock: (params: GetBlockParams) => Promise<any>;\n\tgetRawBlock: (params: GetRawBlockParams) => Promise<RawBlockResponse | null>;\n\tgetBlockHeight: () => Promise<number>;\n\treadContract: (params: ReadContractParams) => Promise<ClarityValue>;\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\tgetContractAbi: (params: GetContractAbiParams) => Promise<any>;\n\tgetContractSource: (\n\t\tparams: GetContractSourceParams,\n\t) => Promise<ContractSourceResponse | null>;\n\tgetDataVar: (params: GetDataVarParams) => Promise<ClarityValue>;\n\tgetMapEntry: (params: GetMapEntryParams) => Promise<ClarityValue>;\n\testimateFee: (params: EstimateFeeParams) => Promise<FeeEstimation[]>;\n\tmulticall: <T extends boolean = true>(\n\t\tparams: MulticallParams<T>,\n\t) => Promise<MulticallResult<T>>;\n\tsimulateCall: (params: SimulateCallParams) => Promise<SimulateCallResult>;\n\tsimulateTransaction: (\n\t\tparams: SimulateTransactionParams,\n\t) => Promise<SimulateTransactionResult>;\n\tgetTransaction: (\n\t\tparams: GetTransactionParams,\n\t) => Promise<TransactionReceipt | null>;\n\tgetAccountHistory: (\n\t\tparams: GetAccountHistoryParams,\n\t) => Promise<AccountHistoryResponse>;\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\tgetMempoolStats: () => Promise<any>;\n\tgetNftHoldings: (\n\t\tparams: GetNftHoldingsParams,\n\t) => Promise<NftHoldingsResponse>;\n\twaitForTransactionReceipt: (\n\t\tparams: WaitForTransactionReceiptParams,\n\t) => Promise<TransactionReceipt>;\n\twatchBlocks: (params: WatchBlocksParams) => Promise<Subscription>;\n\twatchMempool: (params: WatchMempoolParams) => Promise<Subscription>;\n\twatchTransaction: (params: WatchTransactionParams) => Promise<Subscription>;\n\twatchAddress: (params: WatchAddressParams) => Promise<Subscription>;\n\twatchAddressBalance: (\n\t\tparams: WatchAddressBalanceParams,\n\t) => Promise<Subscription>;\n\twatchNftEvent: (params: WatchNftEventParams) => Promise<Subscription>;\n};\n\n/** Decorator that binds {@link PublicActions} to a client instance. */\nexport function publicActions(client: Client): PublicActions {\n\treturn {\n\t\tgetNonce: (params) => getNonce(client, params),\n\t\tgetBalance: (params) => getBalance(client, params),\n\t\tgetAccountInfo: (params) => getAccountInfo(client, params),\n\t\tgetBlock: (params) => getBlock(client, params),\n\t\tgetRawBlock: (params) => getRawBlock(client, params),\n\t\tgetBlockHeight: () => getBlockHeight(client),\n\t\treadContract: (params) => readContract(client, params),\n\t\tgetContractAbi: (params) => getContractAbi(client, params),\n\t\tgetContractSource: (params) => getContractSource(client, params),\n\t\tgetDataVar: (params) => getDataVar(client, params),\n\t\tgetMapEntry: (params) => getMapEntry(client, params),\n\t\testimateFee: (params) => estimateFee(client, params),\n\t\tmulticall: (params) => multicall(client, params),\n\t\tsimulateCall: (params) => simulateCall(client, params),\n\t\tsimulateTransaction: (params) => simulateTransaction(client, params),\n\t\tgetTransaction: (params) => getTransaction(client, params),\n\t\tgetAccountHistory: (params) => getAccountHistory(client, params),\n\t\tgetMempoolStats: () => getMempoolStats(client),\n\t\tgetNftHoldings: (params) => getNftHoldings(client, params),\n\t\twaitForTransactionReceipt: (params) =>\n\t\t\twaitForTransactionReceipt(client, params),\n\t\twatchBlocks: (params) => watchBlocks(client, params),\n\t\twatchMempool: (params) => watchMempool(client, params),\n\t\twatchTransaction: (params) => watchTransaction(client, params),\n\t\twatchAddress: (params) => watchAddress(client, params),\n\t\twatchAddressBalance: (params) => watchAddressBalance(client, params),\n\t\twatchNftEvent: (params) => watchNftEvent(client, params),\n\t};\n}\n",
    "import { createClient } from \"./createClient.ts\";\nimport { type PublicActions, publicActions } from \"./decorators/public.ts\";\nimport type { Client, ClientConfig } from \"./types.ts\";\n\n/** Configuration for {@link createPublicClient} (no account needed). */\nexport type PublicClientConfig = Omit<ClientConfig, \"account\">;\n\n/**\n * Create a read-only client pre-extended with {@link PublicActions}.\n * Use for queries, contract reads, and event subscriptions.\n */\nexport function createPublicClient(\n\tconfig: PublicClientConfig,\n): Client<PublicActions> & PublicActions {\n\treturn createClient(config).extend(publicActions);\n}\n",
    "import {\n\ttype CallContractParams,\n\tcallContract,\n} from \"../../actions/wallet/callContract.ts\";\nimport {\n\ttype DeployContractParams,\n\tdeployContract,\n} from \"../../actions/wallet/deployContract.ts\";\nimport {\n\ttype SendTransactionParams,\n\ttype SendTransactionResult,\n\tsendTransaction,\n} from \"../../actions/wallet/sendTransaction.ts\";\nimport {\n\ttype SignMessageParams,\n\tsignMessage,\n} from \"../../actions/wallet/signMessage.ts\";\nimport {\n\ttype SignTransactionParams,\n\tsignTransactionAction,\n} from \"../../actions/wallet/signTransaction.ts\";\nimport {\n\ttype SponsorTransactionParams,\n\tsponsorTransaction,\n} from \"../../actions/wallet/sponsorTransaction.ts\";\nimport {\n\ttype TransferStxParams,\n\ttransferStx,\n} from \"../../actions/wallet/transferStx.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport type { Client } from \"../types.ts\";\n\n/** Signing actions: send transactions, transfer STX, call/deploy contracts, sign messages. */\nexport type WalletActions = {\n\tsendTransaction: (\n\t\tparams: SendTransactionParams,\n\t) => Promise<SendTransactionResult>;\n\tsignTransaction: (\n\t\tparams: SignTransactionParams,\n\t) => Promise<StacksTransaction>;\n\ttransferStx: (params: TransferStxParams) => Promise<string>;\n\tcallContract: (params: CallContractParams) => Promise<string>;\n\tdeployContract: (params: DeployContractParams) => Promise<string>;\n\tsignMessage: (params: SignMessageParams) => Promise<string>;\n\tsponsorTransaction: (\n\t\tparams: SponsorTransactionParams,\n\t) => Promise<StacksTransaction>;\n};\n\n/** Decorator that binds {@link WalletActions} to a client instance. */\nexport function walletActions(client: Client): WalletActions {\n\treturn {\n\t\tsendTransaction: (params) => sendTransaction(client, params),\n\t\tsignTransaction: (params) => signTransactionAction(client, params),\n\t\ttransferStx: (params) => transferStx(client, params),\n\t\tcallContract: (params) => callContract(client, params),\n\t\tdeployContract: (params) => deployContract(client, params),\n\t\tsignMessage: (params) => signMessage(client, params),\n\t\tsponsorTransaction: (params) => sponsorTransaction(client, params),\n\t};\n}\n",
    "import { createClient } from \"./createClient.ts\";\nimport { type WalletActions, walletActions } from \"./decorators/wallet.ts\";\nimport type { Account, Client, ClientConfig } from \"./types.ts\";\n\n/** Configuration for {@link createWalletClient} — requires an account for signing. */\nexport type WalletClientConfig = ClientConfig & {\n\taccount: Account;\n};\n\n/**\n * Create a client pre-extended with {@link WalletActions} for signing and broadcasting transactions.\n */\nexport function createWalletClient(\n\tconfig: WalletClientConfig,\n): Client<WalletActions> & WalletActions & { account: Account } {\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\treturn createClient(config).extend(walletActions) as any;\n}\n",
    "import { estimateFee } from \"../../actions/public/estimateFee.ts\";\nimport { getNonce } from \"../../actions/public/getNonce.ts\";\nimport {\n\ttype SendTransactionResult,\n\tsendTransaction,\n} from \"../../actions/wallet/sendTransaction.ts\";\nimport { setUnsignedFee } from \"../../actions/wallet/utils.ts\";\nimport type { ClarityValue } from \"../../clarity/types.ts\";\nimport type {\n\tPostConditionInput,\n\tPostConditionMode,\n} from \"../../postconditions/types.ts\";\nimport {\n\tbuildContractCall,\n\tbuildContractDeploy,\n\tbuildTokenTransfer,\n} from \"../../transactions/build.ts\";\nimport {\n\tfinalizeMultiSig,\n\tmakeMultiSigAddress,\n} from \"../../transactions/multisig.ts\";\nimport type {\n\tClarityVersion,\n\tMultiSigHashMode,\n\tStacksTransaction,\n} from \"../../transactions/types.ts\";\nimport { parseContractId } from \"../../utils/address.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport type { Client } from \"../types.ts\";\n\nexport type MultiSigTransferStxParams = {\n\tto: string;\n\tamount: IntegerType;\n\tmemo?: string;\n\tfee?: IntegerType;\n\tnonce?: IntegerType;\n\tpostConditionMode?: PostConditionMode;\n\tpostConditions?: PostConditionInput[];\n};\n\nexport type MultiSigCallContractParams = {\n\tcontract: string;\n\tfunctionName: string;\n\tfunctionArgs?: ClarityValue[];\n\tfee?: IntegerType;\n\tnonce?: IntegerType;\n\tpostConditionMode?: PostConditionMode;\n\tpostConditions?: PostConditionInput[];\n};\n\nexport type MultiSigDeployContractParams = {\n\tcontractName: string;\n\tcodeBody: string;\n\tclarityVersion?: ClarityVersion;\n\tfee?: IntegerType;\n\tnonce?: IntegerType;\n\tpostConditionMode?: PostConditionMode;\n\tpostConditions?: PostConditionInput[];\n};\n\nexport type MultiSigSendTransactionParams = {\n\ttransaction: StacksTransaction;\n\tattachment?: Uint8Array | string;\n};\n\n/** Multi-sig transaction actions: build unsigned transactions and broadcast with auto-finalization. */\nexport type MultiSigActions = {\n\ttransferStx: (\n\t\tparams: MultiSigTransferStxParams,\n\t) => Promise<StacksTransaction>;\n\tcallContract: (\n\t\tparams: MultiSigCallContractParams,\n\t) => Promise<StacksTransaction>;\n\tdeployContract: (\n\t\tparams: MultiSigDeployContractParams,\n\t) => Promise<StacksTransaction>;\n\tsendTransaction: (\n\t\tparams: MultiSigSendTransactionParams,\n\t) => Promise<SendTransactionResult>;\n};\n\n/** Decorator that binds {@link MultiSigActions} to a multi-sig client. */\nexport function multisigActions(client: Client): MultiSigActions {\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\tconst msConfig = (client as any)._multisigConfig as {\n\t\tsigners: string[];\n\t\trequiredSignatures: number;\n\t\thashMode?: MultiSigHashMode;\n\t};\n\n\tif (!msConfig) throw new Error(\"multisigActions requires a multi-sig client\");\n\n\tconst { signers, requiredSignatures, hashMode } = msConfig;\n\n\t/** Resolve nonce from the multi-sig address */\n\tasync function resolveNonce(nonce?: IntegerType): Promise<IntegerType> {\n\t\tif (nonce !== undefined) return nonce;\n\t\tconst address = makeMultiSigAddress(\n\t\t\tsigners,\n\t\t\trequiredSignatures,\n\t\t\tclient.chain,\n\t\t);\n\t\tif (client.nonceManager)\n\t\t\treturn client.nonceManager.consume({ client, address });\n\t\treturn getNonce(client, { address });\n\t}\n\n\treturn {\n\t\tasync transferStx(params) {\n\t\t\tconst nonce = await resolveNonce(params.nonce);\n\n\t\t\tconst unsigned = buildTokenTransfer({\n\t\t\t\trecipient: params.to,\n\t\t\t\tamount: params.amount,\n\t\t\t\tmemo: params.memo,\n\t\t\t\tfee: params.fee ?? 0n,\n\t\t\t\tnonce,\n\t\t\t\tpublicKeys: signers,\n\t\t\t\tsignaturesRequired: requiredSignatures,\n\t\t\t\thashMode,\n\t\t\t\tchain: client.chain,\n\t\t\t\tpostConditionMode: params.postConditionMode,\n\t\t\t\tpostConditions: params.postConditions,\n\t\t\t});\n\n\t\t\tif (params.fee === undefined) {\n\t\t\t\tconst estimates = await estimateFee(client, { transaction: unsigned });\n\t\t\t\tconst mid = estimates[1] ?? estimates[0];\n\t\t\t\tif (mid) {\n\t\t\t\t\tsetUnsignedFee(unsigned, BigInt(mid.fee));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn unsigned;\n\t\t},\n\n\t\tasync callContract(params) {\n\t\t\tconst [contractAddress, contractName] = parseContractId(params.contract);\n\t\t\tconst nonce = await resolveNonce(params.nonce);\n\n\t\t\tconst unsigned = buildContractCall({\n\t\t\t\tcontractAddress,\n\t\t\t\tcontractName,\n\t\t\t\tfunctionName: params.functionName,\n\t\t\t\tfunctionArgs: params.functionArgs ?? [],\n\t\t\t\tfee: params.fee ?? 0n,\n\t\t\t\tnonce,\n\t\t\t\tpublicKeys: signers,\n\t\t\t\tsignaturesRequired: requiredSignatures,\n\t\t\t\thashMode,\n\t\t\t\tchain: client.chain,\n\t\t\t\tpostConditionMode: params.postConditionMode,\n\t\t\t\tpostConditions: params.postConditions,\n\t\t\t});\n\n\t\t\tif (params.fee === undefined) {\n\t\t\t\tconst estimates = await estimateFee(client, { transaction: unsigned });\n\t\t\t\tconst mid = estimates[1] ?? estimates[0];\n\t\t\t\tif (mid) {\n\t\t\t\t\tsetUnsignedFee(unsigned, BigInt(mid.fee));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn unsigned;\n\t\t},\n\n\t\tasync deployContract(params) {\n\t\t\tconst nonce = await resolveNonce(params.nonce);\n\n\t\t\tconst unsigned = buildContractDeploy({\n\t\t\t\tcontractName: params.contractName,\n\t\t\t\tcodeBody: params.codeBody,\n\t\t\t\tclarityVersion: params.clarityVersion,\n\t\t\t\tfee: params.fee ?? 0n,\n\t\t\t\tnonce,\n\t\t\t\tpublicKeys: signers,\n\t\t\t\tsignaturesRequired: requiredSignatures,\n\t\t\t\thashMode,\n\t\t\t\tchain: client.chain,\n\t\t\t\tpostConditionMode: params.postConditionMode,\n\t\t\t\tpostConditions: params.postConditions,\n\t\t\t});\n\n\t\t\tif (params.fee === undefined) {\n\t\t\t\tconst estimates = await estimateFee(client, { transaction: unsigned });\n\t\t\t\tconst mid = estimates[1] ?? estimates[0];\n\t\t\t\tif (mid) {\n\t\t\t\t\tsetUnsignedFee(unsigned, BigInt(mid.fee));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn unsigned;\n\t\t},\n\n\t\tasync sendTransaction(params) {\n\t\t\t// Auto-finalize before broadcast\n\t\t\tconst finalized = finalizeMultiSig(params.transaction, signers);\n\t\t\treturn sendTransaction(client, {\n\t\t\t\ttransaction: finalized,\n\t\t\t\tattachment: params.attachment,\n\t\t\t});\n\t\t},\n\t};\n}\n",
    "import type { MultiSigHashMode } from \"../transactions/types.ts\";\nimport { createClient } from \"./createClient.ts\";\nimport {\n\ttype MultiSigActions,\n\tmultisigActions,\n} from \"./decorators/multisig.ts\";\nimport type { Client, ClientConfig } from \"./types.ts\";\n\n/** Configuration for {@link createMultiSigClient} — requires signer public keys and threshold. */\nexport type MultiSigClientConfig = Omit<ClientConfig, \"account\"> & {\n\tsigners: string[];\n\trequiredSignatures: number;\n\thashMode?: MultiSigHashMode;\n};\n\n/** A client pre-extended with {@link MultiSigActions} for m-of-n signing flows. */\nexport type MultiSigClient = Client<MultiSigActions> & MultiSigActions;\n\n/**\n * Create a client for multi-sig transaction flows.\n * Builds unsigned transactions that can be signed by each party then broadcast.\n */\nexport function createMultiSigClient(\n\tconfig: MultiSigClientConfig,\n): MultiSigClient {\n\tconst client = createClient(config);\n\n\t// Attach multi-sig config for the decorator to read\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t(client as any)._multisigConfig = {\n\t\tsigners: config.signers,\n\t\trequiredSignatures: config.requiredSignatures,\n\t\thashMode: config.hashMode,\n\t};\n\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\treturn client.extend(multisigActions) as any;\n}\n",
    "import type { NonceStore } from \"./nonceManager.ts\";\n\n/**\n * Persisted {@link NonceStore} adapters for multi-process / multi-builder\n * deployments (the smart-wallet-as-a-service case).\n *\n * The in-memory {@link memoryStore} is correct only within one process: two\n * workers sharing a signing key both read the same confirmed floor and collide.\n * These adapters move the atomic reserve into a shared datastore — Redis `INCR`\n * inside an `EVAL`, or a single Postgres upsert under a row lock — so the store\n * itself becomes the cross-process lock and the durable source of truth.\n *\n * Both are dependency-injected: pass your own `Bun.redis` / `Bun.sql` client.\n * No global `Bun` reference, so importing this module is runtime-agnostic.\n */\n\n/** Minimal structural shape of a `Bun.redis` client (the `send` escape hatch). */\nexport type RedisLike = {\n\tsend(command: string, args: string[]): Promise<unknown>;\n};\n\nexport type RedisStoreParams = {\n\tredis: RedisLike;\n\t/** Key prefix for stored nonce counters. Default `\"stacks:nonce:\"`. */\n\tprefix?: string;\n};\n\n// Warm path: counter exists → atomically hand out the current value and bump.\n// Returns the nonce (bulk string) or `false` (RESP nil) when the key is unset.\nconst TAKE_IF_PRESENT = `local v = redis.call('GET', KEYS[1])\nif v == false then return false end\nredis.call('INCR', KEYS[1])\nreturn v`;\n\n// Cold path: seed from the confirmed floor if still unset, then hand out and\n// bump. Atomic, so two racing cold reservers can never return the same nonce.\nconst SEED_OR_TAKE = `local v = redis.call('GET', KEYS[1])\nif v == false then redis.call('SET', KEYS[1], ARGV[1]); v = ARGV[1] end\nredis.call('INCR', KEYS[1])\nreturn v`;\n\n// Release path: roll back one step only if the counter still sits right\n// after the released nonce (ARGV[1] = nonce + 1, ARGV[2] = nonce). String\n// compare keeps bigint nonces exact without Lua number conversion.\nconst RELEASE_IF_LATEST = `local v = redis.call('GET', KEYS[1])\nif v ~= false and v == ARGV[1] then redis.call('SET', KEYS[1], ARGV[2]) end\nreturn v`;\n\n/**\n * Redis-backed nonce store. The atomic reserve lives in a Lua `EVAL`, so it is\n * safe across processes sharing one Redis. The confirmed floor (`getFloor`) is\n * read only once per key, on cold start.\n */\nexport function redisStore(params: RedisStoreParams): NonceStore {\n\tconst { redis } = params;\n\tconst prefix = params.prefix ?? \"stacks:nonce:\";\n\n\treturn {\n\t\tasync reserve(key, getFloor) {\n\t\t\tconst k = prefix + key;\n\t\t\tconst present = await redis.send(\"EVAL\", [TAKE_IF_PRESENT, \"1\", k]);\n\t\t\tif (present != null) return BigInt(present as string | number);\n\n\t\t\tconst floor = await getFloor();\n\t\t\tconst seeded = await redis.send(\"EVAL\", [\n\t\t\t\tSEED_OR_TAKE,\n\t\t\t\t\"1\",\n\t\t\t\tk,\n\t\t\t\tfloor.toString(),\n\t\t\t]);\n\t\t\treturn BigInt(seeded as string | number);\n\t\t},\n\t\tasync reset(key) {\n\t\t\tawait redis.send(\"DEL\", [prefix + key]);\n\t\t},\n\t\tasync release(key, nonce) {\n\t\t\tawait redis.send(\"EVAL\", [\n\t\t\t\tRELEASE_IF_LATEST,\n\t\t\t\t\"1\",\n\t\t\t\tprefix + key,\n\t\t\t\t(nonce + 1n).toString(),\n\t\t\t\tnonce.toString(),\n\t\t\t]);\n\t\t},\n\t\tasync peek(key) {\n\t\t\tconst v = await redis.send(\"GET\", [prefix + key]);\n\t\t\treturn v == null ? undefined : BigInt(v as string | number);\n\t\t},\n\t};\n}\n\n/** Minimal structural shape of a `Bun.sql` tagged-template client. */\nexport type SqlLike = (\n\tstrings: TemplateStringsArray,\n\t...values: unknown[]\n) => Promise<Array<Record<string, unknown>>>;\n\nexport type PostgresStoreParams = {\n\tsql: SqlLike;\n\t/**\n\t * Run `CREATE TABLE IF NOT EXISTS stacks_nonce_state` lazily on first use.\n\t * Default `true`. Set `false` if you manage the schema via migrations.\n\t */\n\tensureTable?: boolean;\n};\n\n/**\n * Postgres-backed nonce store. Each reserve is a single atomic statement under\n * a row lock, so concurrent reservers on the same key serialize and never\n * collide across processes. State is durable — survives restarts.\n *\n * Uses a fixed table `stacks_nonce_state (key text primary key, next numeric)`.\n */\nexport function postgresStore(params: PostgresStoreParams): NonceStore {\n\tconst { sql } = params;\n\tconst shouldEnsure = params.ensureTable ?? true;\n\tlet ensured = false;\n\n\tasync function ensureTable() {\n\t\tif (!shouldEnsure || ensured) return;\n\t\tawait sql`CREATE TABLE IF NOT EXISTS stacks_nonce_state (key text PRIMARY KEY, next numeric NOT NULL)`;\n\t\tensured = true;\n\t}\n\n\treturn {\n\t\tasync reserve(key, getFloor) {\n\t\t\tawait ensureTable();\n\n\t\t\t// Warm path: bump and return the pre-increment value atomically.\n\t\t\tconst updated =\n\t\t\t\tawait sql`UPDATE stacks_nonce_state SET next = next + 1 WHERE key = ${key} RETURNING next - 1 AS nonce`;\n\t\t\tconst warm = updated[0];\n\t\t\tif (warm) return BigInt(String(warm.nonce));\n\n\t\t\t// Cold path: seed from the confirmed floor. ON CONFLICT keeps the seed\n\t\t\t// atomic against a racing reserver.\n\t\t\tconst floor = await getFloor();\n\t\t\tconst seeded =\n\t\t\t\tawait sql`INSERT INTO stacks_nonce_state (key, next) VALUES (${key}, ${(floor + 1n).toString()}) ON CONFLICT (key) DO UPDATE SET next = stacks_nonce_state.next + 1 RETURNING next - 1 AS nonce`;\n\t\t\tconst cold = seeded[0];\n\t\t\tif (!cold) throw new Error(\"postgresStore: insert returned no row\");\n\t\t\treturn BigInt(String(cold.nonce));\n\t\t},\n\t\tasync reset(key) {\n\t\t\tawait ensureTable();\n\t\t\tawait sql`DELETE FROM stacks_nonce_state WHERE key = ${key}`;\n\t\t},\n\t\tasync release(key, nonce) {\n\t\t\tawait ensureTable();\n\t\t\t// Single conditional UPDATE: atomic under the row lock, no-op unless\n\t\t\t// the released nonce is the latest one issued.\n\t\t\tawait sql`UPDATE stacks_nonce_state SET next = ${nonce.toString()} WHERE key = ${key} AND next = ${(nonce + 1n).toString()}`;\n\t\t},\n\t\tasync peek(key) {\n\t\t\tawait ensureTable();\n\t\t\tconst rows =\n\t\t\t\tawait sql`SELECT next FROM stacks_nonce_state WHERE key = ${key}`;\n\t\t\tconst row = rows[0];\n\t\t\treturn row ? BigInt(String(row.next)) : undefined;\n\t\t},\n\t};\n}\n",
    "import type { Client } from \"../../clients/types.ts\";\nimport { getNonce } from \"../public/getNonce.ts\";\nimport {\n\tIndexSourceConfigError,\n\tindexNotFound,\n\tindexRequestFn,\n} from \"../public/txSources.ts\";\nimport type { NonceManagerSource } from \"./nonceManager.ts\";\n\n/**\n * Mempool-aware {@link NonceManagerSource}s.\n *\n * The default {@link jsonRpcSource} reads only the confirmed nonce, so a tx\n * sitting in the mempool is invisible — broadcasting many quickly forces manual\n * tracking. These sources fold pending (mempool) txs into the next-nonce\n * computation. The gap-filling core is generic; where the pending set comes from\n * is pluggable, so you are never locked to any one provider:\n *\n *   - {@link mempoolAwareSource} — bring your own `getPending`.\n *   - {@link indexSource}: prebuilt over a Secondlayer instance's `/v1/index/mempool`.\n *   - {@link hiroNonceSource} — prebuilt over Hiro's `/extended` nonces endpoint.\n */\n\ntype FetchImpl = typeof globalThis.fetch;\n\nfunction resolveFetch(fetchImpl?: FetchImpl): FetchImpl {\n\tconst f = fetchImpl ?? globalThis.fetch;\n\tif (!f)\n\t\tthrow new Error(\"No fetch implementation available; pass `fetchImpl`\");\n\treturn f;\n}\n\n/**\n * The next free nonce ≥ `confirmed` not already taken by a pending tx.\n *\n * Unlike Hiro's `possible_next_nonce` (which is `max(pending) + 1` and strands\n * higher txs when a lower nonce is missing), this FILLS gaps: it returns the\n * lowest unused slot, so a dropped-tx hole is reused instead of stranding the\n * chain.\n */\nexport function nextFreeNonce(confirmed: bigint, pending: bigint[]): bigint {\n\tconst taken = new Set(\n\t\tpending.filter((n) => n >= confirmed).map((n) => n.toString()),\n\t);\n\tlet n = confirmed;\n\twhile (taken.has(n.toString())) n += 1n;\n\treturn n;\n}\n\nexport type MempoolAwareSourceParams = {\n\t/** Pending (mempool) nonces for an address. */\n\tgetPending: (args: {\n\t\tclient: Client;\n\t\taddress: string;\n\t}) => Promise<bigint[]>;\n\t/**\n\t * Confirmed-nonce floor. Defaults to the node's `/v2/accounts` read — the\n\t * user's own node via the client transport, no provider dependency.\n\t */\n\tgetConfirmed?: (args: { client: Client; address: string }) => Promise<bigint>;\n};\n\n/**\n * Build a gap-filling, mempool-aware source from any `getPending`. The confirmed\n * floor defaults to the node read; if `getPending` throws, the source degrades\n * to confirmed-only rather than blocking a broadcast. A misconfigured pending\n * feed ({@link IndexSourceConfigError}) is rethrown: it would fail on every\n * read, and degrading silently would hide that the mempool is never consulted.\n */\nexport function mempoolAwareSource(\n\tparams: MempoolAwareSourceParams,\n): NonceManagerSource {\n\tconst getConfirmed =\n\t\tparams.getConfirmed ??\n\t\t(({ client, address }) => getNonce(client, { address }));\n\n\treturn {\n\t\tasync get({ client, address }) {\n\t\t\tconst confirmed = await getConfirmed({ client, address });\n\t\t\tlet pending: bigint[] = [];\n\t\t\ttry {\n\t\t\t\tpending = await params.getPending({ client, address });\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof IndexSourceConfigError) throw error;\n\t\t\t\t// Source unavailable: fall back to the confirmed floor. The local\n\t\t\t\t// increment in the manager still prevents same-process collisions.\n\t\t\t\treturn confirmed;\n\t\t\t}\n\t\t\treturn nextFreeNonce(confirmed, pending);\n\t\t},\n\t};\n}\n\nexport type IndexSourceParams = {\n\t/**\n\t * URL of your Secondlayer instance. Without it the client's transport\n\t * URL is assumed to be the instance: a transport on a Hiro host throws\n\t * up front, and a host that answers `/v1/index` with a non-JSON 404\n\t * (a bare stacks-node) throws on the first read. Neither is degraded\n\t * to the confirmed floor. Pass it whenever the transport is not the\n\t * instance.\n\t */\n\tbaseUrl?: string;\n\t/** Instance token, sent as `Authorization: Bearer`. */\n\tapiKey?: string;\n\t/** Max mempool pages to read per address. Default 10 (×200 = 2000 txs). */\n\tmaxPages?: number;\n\t/** Override the confirmed floor (defaults to the node read). */\n\tgetConfirmed?: (args: { client: Client; address: string }) => Promise<bigint>;\n};\n\ntype IndexMempoolResponse = {\n\tmempool?: Array<{ nonce?: string | number | null }>;\n\tnext_cursor?: string | null;\n};\n\n/**\n * Mempool-aware source backed by a Secondlayer instance's `/v1/index/mempool`.\n * Requests go through the transport layer (retries, timeout, typed errors).\n * The instance's mempool is a go-forward view observed by its own node, so\n * it can lag or miss transactions that node never saw; the manager's local\n * increment still prevents same-process collisions. Past `maxPages` the\n * pending set is truncated and the next free nonce may already be taken;\n * a nonce conflict at broadcast then resets the manager. Transient failures\n * (5xx, timeout) degrade to the confirmed floor; a missing or wrong instance\n * URL throws so the misconfiguration is visible on the first read.\n */\nexport function indexSource(\n\tparams: IndexSourceParams = {},\n): NonceManagerSource {\n\tconst maxPages = params.maxPages ?? 10;\n\tconst headers = params.apiKey\n\t\t? { authorization: `Bearer ${params.apiKey}` }\n\t\t: undefined;\n\n\tconst source = mempoolAwareSource({\n\t\tgetConfirmed: params.getConfirmed,\n\t\tasync getPending({ client, address }) {\n\t\t\tconst request = indexRequestFn(client, params.baseUrl, \"indexSource\");\n\t\t\tconst out: bigint[] = [];\n\t\t\tlet cursor: string | undefined;\n\t\t\tlet pages = 0;\n\n\t\t\tdo {\n\t\t\t\tconst query = new URLSearchParams({\n\t\t\t\t\tsender: address,\n\t\t\t\t\tlimit: \"200\",\n\t\t\t\t});\n\t\t\t\tif (cursor) query.set(\"from_cursor\", cursor);\n\n\t\t\t\tlet data: IndexMempoolResponse;\n\t\t\t\ttry {\n\t\t\t\t\tdata = (await request(`/v1/index/mempool?${query}`, {\n\t\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\t\theaders,\n\t\t\t\t\t})) as IndexMempoolResponse;\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// A JSON 404 is an instance with nothing for this sender; a\n\t\t\t\t\t// non-JSON 404 is not an instance and throws a config error.\n\t\t\t\t\tif (indexNotFound(error, \"indexSource\")) break;\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tfor (const tx of data.mempool ?? []) {\n\t\t\t\t\tif (tx.nonce != null) out.push(BigInt(tx.nonce));\n\t\t\t\t}\n\t\t\t\tcursor = data.next_cursor ?? undefined;\n\t\t\t\tpages += 1;\n\t\t\t} while (cursor && pages < maxPages);\n\n\t\t\treturn out;\n\t\t},\n\t});\n\n\treturn {\n\t\tasync get(args) {\n\t\t\t// Resolve the instance before the degrade path so a missing or\n\t\t\t// Hiro-pointed transport URL rejects instead of returning the floor.\n\t\t\tindexRequestFn(args.client, params.baseUrl, \"indexSource\");\n\t\t\treturn source.get(args);\n\t\t},\n\t};\n}\n\nexport type HiroNonceSourceParams = {\n\t/** Hiro API base URL, e.g. `https://api.hiro.so` or `https://api.testnet.hiro.so`. */\n\tbaseUrl: string;\n\tapiKey?: string;\n\tfetchImpl?: FetchImpl;\n};\n\ntype HiroNoncesResponse = {\n\tlast_executed_tx_nonce?: number | null;\n\tlast_mempool_tx_nonce?: number | null;\n\tpossible_next_nonce?: number | null;\n\tdetected_missing_nonces?: number[];\n};\n\n/**\n * Off-the-shelf, non-Secondlayer mempool-aware source over Hiro's\n * `/extended/v1/address/{address}/nonces`. Fills the lowest detected gap first,\n * then falls back to `possible_next_nonce`. Requires a host that serves Hiro's\n * extended API (a bare stacks-node does not).\n */\nexport function hiroNonceSource(\n\tparams: HiroNonceSourceParams,\n): NonceManagerSource {\n\tconst baseUrl = params.baseUrl.replace(/\\/$/, \"\");\n\tconst fetchImpl = resolveFetch(params.fetchImpl);\n\n\treturn {\n\t\tasync get({ address }) {\n\t\t\tconst res = await fetchImpl(\n\t\t\t\t`${baseUrl}/extended/v1/address/${address}/nonces`,\n\t\t\t\t{\n\t\t\t\t\theaders: params.apiKey ? { \"x-api-key\": params.apiKey } : undefined,\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (!res.ok) {\n\t\t\t\tthrow new Error(`hiroNonceSource: /nonces ${res.status}`);\n\t\t\t}\n\t\t\tconst data = (await res.json()) as HiroNoncesResponse;\n\n\t\t\t// Fill the lowest gap first — possible_next_nonce ignores gaps and would\n\t\t\t// strand the missing slots.\n\t\t\tconst missing = (data.detected_missing_nonces ?? [])\n\t\t\t\t.map((n) => BigInt(n))\n\t\t\t\t.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));\n\t\t\tif (missing[0] !== undefined) return missing[0];\n\n\t\t\treturn BigInt(data.possible_next_nonce ?? 0);\n\t\t},\n\t};\n}\n",
    "import { buildRequestFn, createTransport } from \"./createTransport.ts\";\nimport type { TransportConfig, TransportFactory } from \"./types.ts\";\n\n/**\n * Create an HTTP transport for Stacks node RPC calls.\n * Falls back to the chain's default RPC URL, then `localhost:3999`.\n */\nexport function http(url?: string, config?: TransportConfig): TransportFactory {\n\treturn (params) => {\n\t\tconst resolvedUrl =\n\t\t\turl ?? params?.chain?.rpcUrls.default.http[0] ?? \"http://localhost:3999\";\n\n\t\tconst mergedConfig: TransportConfig = {\n\t\t\t...config,\n\t\t\turl: resolvedUrl,\n\t\t};\n\n\t\treturn createTransport(\"http\", {\n\t\t\t...mergedConfig,\n\t\t\trequest: buildRequestFn(resolvedUrl, mergedConfig),\n\t\t});\n\t};\n}\n",
    "import { createTransport } from \"./createTransport.ts\";\nimport type { RequestFn, TransportFactory } from \"./types.ts\";\n\n/** Create a transport backed by a user-provided request function. */\nexport function custom(params: { request: RequestFn }): TransportFactory {\n\treturn () => createTransport(\"custom\", { request: params.request });\n}\n",
    "import { createTransport } from \"./createTransport.ts\";\nimport type { TransportFactory } from \"./types.ts\";\n\n/** Create a transport that tries each transport in order until one succeeds. */\nexport function fallback(transports: TransportFactory[]): TransportFactory {\n\treturn (params) => {\n\t\tconst resolved = transports.map((t) => t(params));\n\n\t\treturn createTransport(\"fallback\", {\n\t\t\trequest: async (path, options) => {\n\t\t\t\tlet lastError: Error | undefined;\n\t\t\t\tfor (const transport of resolved) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn await transport.request(path, options);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tlastError =\n\t\t\t\t\t\t\terror instanceof Error ? error : new Error(String(error));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthrow lastError ?? new Error(\"All transports failed\");\n\t\t\t},\n\t\t});\n\t};\n}\n",
    "import { WebSocketError } from \"../errors/websocket.ts\";\nimport type {\n\tSubscription,\n\tWsSubscribeParams,\n} from \"../subscriptions/types.ts\";\nimport { buildRequestFn } from \"./createTransport.ts\";\nimport type { Transport, TransportConfig, TransportFactory } from \"./types.ts\";\n\n/** Configuration for the WebSocket transport, extending base {@link TransportConfig}. */\nexport type WebSocketTransportConfig = TransportConfig & {\n\t/** WebSocket URL (resolved from chain if omitted) */\n\turl?: string;\n\t/** Enable auto-reconnect (default: true) */\n\treconnect?: boolean;\n\t/** Max reconnect attempts (default: 10) */\n\treconnectMaxAttempts?: number;\n\t/** Base delay in ms for exponential backoff (default: 1000) */\n\treconnectBaseDelay?: number;\n};\n\n/** Transport with WebSocket subscription capabilities and auto-reconnect. */\nexport type WebSocketTransport = Transport & {\n\ttype: \"webSocket\";\n\tsubscribe: (\n\t\tparams: WsSubscribeParams,\n\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\tcallback: (data: any) => void,\n\t) => Promise<Subscription>;\n\tdestroy: () => void;\n};\n\ntype JsonRpcRequest = {\n\tjsonrpc: \"2.0\";\n\tid: number;\n\tmethod: string;\n\tparams: Record<string, unknown>;\n};\n\ntype JsonRpcResponse = {\n\tjsonrpc: \"2.0\";\n\tid: number;\n\tresult?: unknown;\n\terror?: { code: number; message: string };\n};\n\ntype JsonRpcNotification = {\n\tjsonrpc: \"2.0\";\n\tmethod: string;\n\tparams: unknown;\n};\n\ntype SubEntry = {\n\tparams: WsSubscribeParams;\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\tcallbacks: Set<(data: any) => void>;\n};\n\nfunction subKey(params: WsSubscribeParams): string {\n\tconst parts: string[] = [params.event];\n\tif (params.tx_id) parts.push(`tx_id:${params.tx_id}`);\n\tif (params.address) parts.push(`address:${params.address}`);\n\tif (params.asset_identifier) parts.push(`asset:${params.asset_identifier}`);\n\tif (params.value) parts.push(`value:${params.value}`);\n\treturn parts.join(\"|\");\n}\n\nexport class WebSocketChannel {\n\tprivate ws: WebSocket | null = null;\n\tprivate url: string;\n\tprivate nextId = 1;\n\tprivate pending = new Map<\n\t\tnumber,\n\t\t{ resolve: (v: unknown) => void; reject: (e: Error) => void }\n\t>();\n\tprivate subs = new Map<string, SubEntry>();\n\tprivate destroyed = false;\n\tprivate reconnecting = false;\n\tprivate reconnectAttempt = 0;\n\tprivate reconnectTimer: ReturnType<typeof setTimeout> | null = null;\n\n\tprivate reconnect: boolean;\n\tprivate reconnectMaxAttempts: number;\n\tprivate reconnectBaseDelay: number;\n\n\tconstructor(url: string, config?: WebSocketTransportConfig) {\n\t\tthis.url = url;\n\t\tthis.reconnect = config?.reconnect ?? true;\n\t\tthis.reconnectMaxAttempts = config?.reconnectMaxAttempts ?? 10;\n\t\tthis.reconnectBaseDelay = config?.reconnectBaseDelay ?? 1000;\n\t}\n\n\tprivate connect(): Promise<void> {\n\t\tif (this.ws?.readyState === WebSocket.OPEN) return Promise.resolve();\n\t\tif (this.ws?.readyState === WebSocket.CONNECTING) {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tconst onOpen = () => {\n\t\t\t\t\tthis.ws?.removeEventListener(\"error\", onError);\n\t\t\t\t\tresolve();\n\t\t\t\t};\n\t\t\t\tconst onError = (e: Event) => {\n\t\t\t\t\tthis.ws?.removeEventListener(\"open\", onOpen);\n\t\t\t\t\treject(\n\t\t\t\t\t\tnew WebSocketError(\"WebSocket connection failed\", {\n\t\t\t\t\t\t\tdetails: String(e),\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t\tthis.ws?.addEventListener(\"open\", onOpen, { once: true });\n\t\t\t\tthis.ws?.addEventListener(\"error\", onError, { once: true });\n\t\t\t});\n\t\t}\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.ws = new WebSocket(this.url);\n\n\t\t\tthis.ws.addEventListener(\n\t\t\t\t\"open\",\n\t\t\t\t() => {\n\t\t\t\t\tthis.reconnectAttempt = 0;\n\t\t\t\t\tthis.reconnecting = false;\n\t\t\t\t\tresolve();\n\t\t\t\t},\n\t\t\t\t{ once: true },\n\t\t\t);\n\n\t\t\tthis.ws.addEventListener(\n\t\t\t\t\"error\",\n\t\t\t\t(e) => {\n\t\t\t\t\treject(\n\t\t\t\t\t\tnew WebSocketError(\"WebSocket connection failed\", {\n\t\t\t\t\t\t\tdetails: String(e),\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\t{ once: true },\n\t\t\t);\n\n\t\t\tthis.ws.addEventListener(\"message\", (event) => {\n\t\t\t\tthis.handleMessage(event.data);\n\t\t\t});\n\n\t\t\tthis.ws.addEventListener(\"close\", () => {\n\t\t\t\tif (!this.destroyed) this.handleDisconnect();\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate handleMessage(raw: string | ArrayBuffer | Blob) {\n\t\tconst data =\n\t\t\ttypeof raw === \"string\"\n\t\t\t\t? raw\n\t\t\t\t: new TextDecoder().decode(raw as ArrayBuffer);\n\n\t\tlet msg: JsonRpcResponse | JsonRpcNotification;\n\t\ttry {\n\t\t\tmsg = JSON.parse(data);\n\t\t} catch {\n\t\t\treturn;\n\t\t}\n\n\t\t// RPC response\n\t\tif (\"id\" in msg && msg.id != null) {\n\t\t\tconst rpc = msg as JsonRpcResponse;\n\t\t\tconst p = this.pending.get(rpc.id);\n\t\t\tif (!p) return;\n\t\t\tthis.pending.delete(rpc.id);\n\t\t\tif (rpc.error) {\n\t\t\t\tp.reject(\n\t\t\t\t\tnew WebSocketError(rpc.error.message, {\n\t\t\t\t\t\tdetails: `JSON-RPC error ${rpc.error.code}`,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tp.resolve(rpc.result);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Notification\n\t\tconst notif = msg as JsonRpcNotification;\n\t\tif (!notif.method) return;\n\n\t\tfor (const [, entry] of this.subs) {\n\t\t\tif (entry.params.event === notif.method) {\n\t\t\t\tfor (const cb of entry.callbacks) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tcb(notif.params);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// subscriber error — don't crash channel\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate handleDisconnect() {\n\t\tthis.ws = null;\n\n\t\t// reject pending RPCs\n\t\tfor (const [, p] of this.pending) {\n\t\t\tp.reject(new WebSocketError(\"WebSocket disconnected\"));\n\t\t}\n\t\tthis.pending.clear();\n\n\t\tif (\n\t\t\tthis.reconnect &&\n\t\t\tthis.subs.size > 0 &&\n\t\t\tthis.reconnectAttempt < this.reconnectMaxAttempts\n\t\t) {\n\t\t\tthis.scheduleReconnect();\n\t\t}\n\t}\n\n\tprivate scheduleReconnect() {\n\t\tif (this.destroyed || this.reconnecting) return;\n\t\tthis.reconnecting = true;\n\t\tconst delay = this.reconnectBaseDelay * 2 ** this.reconnectAttempt;\n\t\tthis.reconnectAttempt++;\n\n\t\tthis.reconnectTimer = setTimeout(async () => {\n\t\t\tthis.reconnecting = false;\n\t\t\ttry {\n\t\t\t\tawait this.connect();\n\t\t\t\tawait this.resubscribeAll();\n\t\t\t} catch {\n\t\t\t\tif (!this.destroyed && this.subs.size > 0) {\n\t\t\t\t\tthis.handleDisconnect();\n\t\t\t\t}\n\t\t\t}\n\t\t}, delay);\n\t}\n\n\tprivate async resubscribeAll() {\n\t\tfor (const [, entry] of this.subs) {\n\t\t\tawait this.sendRpc(\"subscribe\", entry.params);\n\t\t}\n\t}\n\n\tprivate sendRpc(\n\t\tmethod: string,\n\t\tparams: Record<string, unknown>,\n\t): Promise<unknown> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (!this.ws || this.ws.readyState !== WebSocket.OPEN) {\n\t\t\t\treturn reject(new WebSocketError(\"WebSocket not connected\"));\n\t\t\t}\n\n\t\t\tconst id = this.nextId++;\n\t\t\tconst msg: JsonRpcRequest = {\n\t\t\t\tjsonrpc: \"2.0\",\n\t\t\t\tid,\n\t\t\t\tmethod,\n\t\t\t\tparams,\n\t\t\t};\n\n\t\t\tthis.pending.set(id, { resolve, reject });\n\t\t\tthis.ws.send(JSON.stringify(msg));\n\t\t});\n\t}\n\n\tasync subscribe(\n\t\tparams: WsSubscribeParams,\n\t\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\t\tcallback: (data: any) => void,\n\t): Promise<Subscription> {\n\t\tif (this.destroyed) {\n\t\t\tthrow new WebSocketError(\"WebSocket channel has been destroyed\");\n\t\t}\n\n\t\tawait this.connect();\n\n\t\tconst key = subKey(params);\n\t\tlet entry = this.subs.get(key);\n\n\t\tif (entry) {\n\t\t\t// Dedup: reuse existing WS subscription\n\t\t\tentry.callbacks.add(callback);\n\t\t} else {\n\t\t\t// New WS subscription\n\t\t\tentry = { params, callbacks: new Set([callback]) };\n\t\t\tthis.subs.set(key, entry);\n\t\t\tawait this.sendRpc(\"subscribe\", params);\n\t\t}\n\n\t\treturn {\n\t\t\tunsubscribe: () => {\n\t\t\t\tconst e = this.subs.get(key);\n\t\t\t\tif (!e) return;\n\t\t\t\te.callbacks.delete(callback);\n\t\t\t\tif (e.callbacks.size === 0) {\n\t\t\t\t\tthis.subs.delete(key);\n\t\t\t\t\t// Best-effort unsubscribe RPC\n\t\t\t\t\tif (this.ws?.readyState === WebSocket.OPEN) {\n\t\t\t\t\t\tthis.sendRpc(\"unsubscribe\", params).catch(() => {});\n\t\t\t\t\t}\n\t\t\t\t\t// Auto-close when no subscribers remain\n\t\t\t\t\tif (this.subs.size === 0) this.closeQuietly();\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate closeQuietly() {\n\t\tif (this.ws) {\n\t\t\tthis.ws.close();\n\t\t\tthis.ws = null;\n\t\t}\n\t}\n\n\tdestroy(): void {\n\t\tthis.destroyed = true;\n\t\tif (this.reconnectTimer) clearTimeout(this.reconnectTimer);\n\n\t\tfor (const [, p] of this.pending) {\n\t\t\tp.reject(new WebSocketError(\"WebSocket channel destroyed\"));\n\t\t}\n\t\tthis.pending.clear();\n\t\tthis.subs.clear();\n\n\t\tif (this.ws) {\n\t\t\tthis.ws.close();\n\t\t\tthis.ws = null;\n\t\t}\n\t}\n}\n\nfunction deriveWsUrl(httpUrl: string): string {\n\treturn `${httpUrl.replace(/^http/, \"ws\").replace(/\\/$/, \"\")}/extended/v1/ws`;\n}\n\n/**\n * Create a WebSocket transport for real-time Stacks event subscriptions.\n * HTTP requests use the resolved RPC URL; subscriptions use the WS endpoint.\n */\nexport function webSocket(\n\turl?: string,\n\tconfig?: WebSocketTransportConfig,\n): TransportFactory {\n\treturn (params) => {\n\t\tconst httpUrl =\n\t\t\tconfig?.url ??\n\t\t\tparams?.chain?.rpcUrls.default.http[0] ??\n\t\t\t\"http://localhost:3999\";\n\n\t\tconst wsUrl =\n\t\t\turl ?? params?.chain?.rpcUrls.default.ws?.[0] ?? deriveWsUrl(httpUrl);\n\n\t\tconst resolvedHttpConfig: TransportConfig = {\n\t\t\t...config,\n\t\t\turl: httpUrl,\n\t\t};\n\n\t\tconst channel = new WebSocketChannel(wsUrl, config);\n\t\t// Same rule as createTransport: the key stays in the request closure.\n\t\tconst { apiKey: _apiKey, ...exposedConfig } = resolvedHttpConfig;\n\n\t\tconst transport: WebSocketTransport = {\n\t\t\ttype: \"webSocket\",\n\t\t\trequest: buildRequestFn(httpUrl, resolvedHttpConfig),\n\t\t\tconfig: exposedConfig,\n\t\t\tsubscribe: (subParams, callback) =>\n\t\t\t\tchannel.subscribe(subParams, callback),\n\t\t\tdestroy: () => channel.destroy(),\n\t\t};\n\n\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