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HO,SAAS4f,GAAepoD,EAAa,GAAI,CAC5C,MAAMwoC,EAASsR,GAAU95C,CAAU,EACnC,OAAOmoD,EAAoB,qBAAE7Z,GAAaM,GAAiBpG,EAAQ,CAAE,SAAA8F,CAAQ,CAAE,EAAG,IAAM3B,GAAenE,CAAM,EAAG,IAAMmE,GAAenE,CAAM,CAAC,CAChJ,CCFO,SAAS6f,GAAcroD,EAAa,GAAI,CAC3C,KAAM,CAAE,SAAAy8C,CAAU,EAAGz8C,EACfwoC,EAASsR,GAAU95C,CAAU,EAC7BsoD,EAAkBtB,GAA0Bxe,CAAM,EAClD,CAAE,OAAAwf,EAAQ,YAAAO,EAAa,GAAGvsD,CAAM,EAAK2rD,GAAY,CACnD,GAAGlL,EACH,GAAG6L,CACX,CAAK,EACD,MAAO,CACH,GAAGtsD,EACH,WAAYosD,GAAe,CAAE,OAAA5f,CAAQ,GAAE,IAAK4C,GAAeA,EAAW,SAAS,EAC/E,WAAY4c,EACZ,gBAAiBO,CACzB,CACA","names":["f","require$$0","k","l","m","n","p","q","c","a","g","b","d","e","h","reactJsxRuntime_production_min","jsxRuntimeModule","defineChain","chain","version","errorConfig","docsBaseUrl","docsPath","docsSlug","BaseError","shortMessage","args","details","docsUrl","message","fn","walk","err","IntegerOutOfRangeError","max","min","signed","size","value","InvalidBytesBooleanError","bytes","SizeOverflowError","givenSize","maxSize","isHex","strict","trim","hexOrBytes","dir","data","sliceLength","i","SliceOffsetOutOfBoundsError","offset","position","SizeExceedsPaddingSizeError","targetSize","type","InvalidBytesLengthError","pad","padHex","padBytes","hex_","hex","paddedBytes","padEnd","hexes","_v","toHex","opts","numberToHex","stringToHex","boolToHex","bytesToHex","assertSize","string","value_","maxValue","minValue","suffix","encoder","toBytes","numberToBytes","boolToBytes","hexToBytes","stringToBytes","charCodeMap","charCodeToBase16","char","hexString","length","index","j","nibbleLeft","nibbleRight","size_","hexToBigInt","hexToNumber","hexToString","transactionType","formatTransaction","transaction","transaction_","formatAuthorizationList","authorizationList","authorization","formatBlock","block","transactions","formatLog","log","eventName","receiptStatuses","formatTransactionReceipt","transactionReceipt","receipt","rpcTransactionType","formatTransactionRequest","request","rpcRequest","x","maxUint256","concat","values","concatHex","concatBytes","arr","result","acc","NegativeOffsetError","PositionOutOfBoundsError","RecursiveReadLimitExceededError","count","limit","staticCursor","position_","byte","oldPosition","createCursor","recursiveReadLimit","cursor","toRlp","to","encodable","getEncodable","getEncodableList","getEncodableBytes","list","bodyLength","sizeOfBodyLength","getSizeOfLength","encode","bytesOrHex","sizeOfBytesLength","etherUnits","gweiUnits","weiUnits","formatUnits","decimals","display","negative","integer","fraction","formatEther","wei","unit","formatGwei","prettyPrint","entries","key","maxLength","FeeConflictError","InvalidSerializableTransactionError","TransactionExecutionError","cause","account","gas","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","prettyArgs","TransactionNotFoundError","blockHash","blockNumber","blockTag","hash","identifier","TransactionReceiptNotFoundError","WaitForTransactionReceiptTimeoutError","blobsToCommitments","parameters","kzg","blobs","commitments","blob","blobsToProofs","proofs","commitment","number","isBytes","lengths","exists","instance","checkFinished","output","out","crypto","u32","createView","rotr","word","shift","isLE","byteSwap","byteSwap32","utf8ToBytes","str","abytes","arrays","sum","res","Hash","wrapConstructor","hashCons","hashC","msg","tmp","randomBytes","bytesLength","setBigUint64","view","byteOffset","_32n","_u32_max","wh","wl","Chi","Maj","HashMD","blockLen","outputLen","padOffset","buffer","len","pos","take","dataView","oview","outLen","state","finished","destroyed","SHA256_K","SHA256_IV","SHA256_W","SHA256","A","B","C","D","E","F","G","H","W15","W2","s0","s1","sigma1","T1","T2","sha256","to_","noble_sha256","commitmentToVersionedHash","versionedHash","commitmentsToVersionedHashes","hashes","blobsPerTransaction","bytesPerFieldElement","fieldElementsPerBlob","bytesPerBlob","maxBytesPerTransaction","BlobSizeTooLargeError","EmptyBlobError","toBlobs","active","toBlobSidecars","sidecars","InvalidAddressError","address","ChainDoesNotSupportContract","contract","ChainMismatchError","currentChainId","ChainNotFoundError","ClientChainNotConfiguredError","ExecutionRevertedError","reason","FeeCapTooHighError","FeeCapTooLowError","NonceTooHighError","NonceTooLowError","NonceMaxValueError","InsufficientFundsError","IntrinsicGasTooHighError","IntrinsicGasTooLowError","TransactionTypeNotSupportedError","TipAboveFeeCapError","UnknownNodeError","LruMap","firstKey","U32_MASK64","fromBig","le","split","lst","Ah","Al","rotlSH","s","rotlSL","rotlBH","rotlBL","SHA3_PI","SHA3_ROTL","_SHA3_IOTA","_0n","_1n","_2n","_7n","_256n","_0x71n","round","R","y","t","SHA3_IOTA_H","SHA3_IOTA_L","rotlH","rotlL","keccakP","rounds","idx1","idx0","B0","B1","Th","Tl","curH","curL","PI","Keccak","enableXOF","bufferOut","gen","keccak_256","keccak256","checksumAddressCache","checksumAddress","address_","chainId","hexAddress","getAddress","isAddress","addressRegex","isAddressCache","options","cacheKey","slice","start","end","sliceHex","sliceBytes","assertStartOffset","assertEndOffset","getTransactionType","assertCurrentChain","getChainContractAddress","name","parseAccount","BaseFeeScalarError","Eip1559FeesNotSupportedError","MaxFeePerGasTooLowError","getAction","client","actionFn","action_implicit","action_explicit","params","BlockNotFoundError","getBlock","blockTag_","includeTransactions_","includeTransactions","blockNumberHex","getGasPrice","internal_estimateMaxPriorityFeePerGas","block_","maxPriorityFeePerGas_","maxPriorityFeePerGasHex","internal_estimateFeesPerGas","baseFeeMultiplier","denominator","multiply","base","fees","baseFeePerGas","publicKeyToAddress","publicKey","recoverPublicKey","signature","hashHex","secp256k1","__vitePreload","secp256k1$1","r","v","yParity","yParityOrV","recoveryBit","toRecoveryBit","signatureHex","recoverAddress","hashAuthorization","contractAddress","recoverAuthorizationAddress","EstimateGasExecutionError","stringify","replacer","space","getContractAddress","getUrl","url","HttpRequestError","body","headers","status","RpcRequestError","error","TimeoutError","unknownErrorCode","RpcError","code","metaMessages","ProviderRpcError","ParseRpcError","InvalidRequestRpcError","MethodNotFoundRpcError","method","InvalidParamsRpcError","InternalRpcError","InvalidInputRpcError","ResourceNotFoundRpcError","ResourceUnavailableRpcError","TransactionRejectedRpcError","MethodNotSupportedRpcError","LimitExceededRpcError","JsonRpcVersionUnsupportedError","UserRejectedRequestError","UnauthorizedProviderError","UnsupportedProviderMethodError","ProviderDisconnectedError","ChainDisconnectedError","SwitchChainError","UnknownRpcError","getNodeError","executionRevertedError","getEstimateGasError","extract","format","extract_","formatted","keys","AccountStateConflictError","StateAssignmentConflictError","prettyStateMapping","stateMapping","pretty","slot","prettyStateOverride","stateOverride","val","serializeStateMapping","serializeAccountStateOverride","balance","stateDiff","rpcAccountStateOverride","serializeStateOverride","rpcStateOverride","accountState","assertRequest","account_","getBalance","estimateGas","estimateGas_rpc","accessList","blobVersionedHashes","maxFeePerBlobGas","rest","prepareTransactionRequest","chainFormat","estimate","estimates","curr","getTransactionCount","getChainId","chainIdHex","defaultParameters","nonceManager","getBlock_","getChainId_","versionedHashes","gasPrice_","AccountNotFoundError","AccountTypeNotSupportedError","panicReasons","solidityError","solidityPanic","formatAbiItem","abiItem","includeName","InvalidDefinitionTypeError","formatAbiParams","param","formatAbiParam","AbiConstructorNotFoundError","AbiConstructorParamsNotFoundError","AbiDecodingDataSizeTooSmallError","AbiDecodingZeroDataError","AbiEncodingArrayLengthMismatchError","expectedLength","givenLength","AbiEncodingBytesSizeMismatchError","expectedSize","AbiEncodingLengthMismatchError","AbiErrorSignatureNotFoundError","AbiFunctionNotFoundError","functionName","AbiFunctionOutputsNotFoundError","AbiItemAmbiguityError","InvalidAbiEncodingTypeError","InvalidAbiDecodingTypeError","InvalidArrayError","hashSignature","sig","execTyped","regex","bytesRegex","integerRegex","isTupleRegex","tupleRegex","formatAbiParameter","abiParameter","component","formatAbiParameters","abiParameters","errorSignatureRegex","isErrorSignature","execErrorSignature","eventSignatureRegex","isEventSignature","execEventSignature","functionSignatureRegex","isFunctionSignature","execFunctionSignature","structSignatureRegex","isStructSignature","execStructSignature","constructorSignatureRegex","isConstructorSignature","execConstructorSignature","fallbackSignatureRegex","isFallbackSignature","receiveSignatureRegex","isReceiveSignature","eventModifiers","functionModifiers","UnknownTypeError","UnknownSolidityTypeError","InvalidParameterError","SolidityProtectedKeywordError","InvalidModifierError","modifier","InvalidFunctionModifierError","InvalidAbiTypeParameterError","InvalidSignatureError","UnknownSignatureError","InvalidStructSignatureError","CircularReferenceError","InvalidParenthesisError","current","depth","getParameterCacheKey","parameterCache","parseSignature","structs","match","inputParams","splitParameters","inputs","inputLength","parseAbiParameter","outputs","outputParams","outputLength","abiParameterWithoutTupleRegex","abiParameterWithTupleRegex","dynamicIntegerRegex","parameterCacheKey","isTuple","isSolidityKeyword","indexed","components","components_","isSolidityType","isValidDataLocation","tail","protectedKeywordsRegex","isArray","parseStructs","signatures","shallowStructs","signaturesLength","properties","propertiesLength","trimmed","resolvedStructs","entriesLength","resolveStructs","typeWithoutTupleRegex","ancestors","array","parseAbi","abi","normalizeSignature","level","valid","toSignature","def","def_","toSignatureHash","toFunctionSelector","bytesToBigInt","bytesToBool","bytes_","bytesToNumber","bytesToString","encodeAbiParameters","preparedParams","prepareParams","encodeParams","prepareParam","arrayComponents","getArrayComponents","encodeArray","encodeTuple","encodeAddress","encodeBool","encodeNumber","encodeBytes","encodeString","staticSize","dynamic","encoded","staticParams","dynamicParams","dynamicSize","dynamicChild","preparedParam","paramSize","bytesSize","hexValue","partsLength","parts","param_","matches","decodeAbiParameters","consumed","consumed_","decodeParameter","staticPosition","decodeArray","decodeTuple","decodeAddress","decodeBool","decodeBytes","decodeNumber","decodeString","sizeOfLength","sizeOfOffset","startOfData","hasDynamicChild","_","hasUnnamedChild","decodeErrorResult","formatAbiItemWithArgs","includeFunctionName","input","toEventSelector","getAbiItem","isSelector","abiItems","matchedAbiItem","arg","isArgOfType","ambiguousTypes","getAmbiguousTypes","argType","abiParameterType","sourceParameters","targetParameters","parameterIndex","sourceParameter","targetParameter","types","CallExecutionError","ContractFunctionExecutionError","sender","formattedArgs","functionWithParams","ContractFunctionRevertedError","decodedData","errorName","errorArgs","firstArg","errorWithParams","ContractFunctionZeroDataError","CounterfactualDeploymentFailedError","factory","RawContractError","getCallError","encodeDeployData","bytecode","description","getTransactionError","sendRawTransaction","serializedTransaction","supportsWalletNamespace","sendTransaction","serializer","multicall3Abi","universalResolverErrors","universalResolverResolveAbi","universalResolverReverseAbi","textResolverAbi","addressResolverAbi","decodeFunctionResult","item","prepareEncodeFunctionData","encodeFunctionData","isNullUniversalResolverError","callType","encodedLabelToLabelhash","label","namehash","labels","hashFromEncodedLabel","hashed","encodeLabelhash","labelhash","packetToBytes","packet","EXECUTION_REVERTED_ERROR_CODE","getContractError","aggregate3Signature","deploylessCallViaBytecodeBytecode","deploylessCallViaFactoryBytecode","schedulerCache","createBatchScheduler","id","shouldSplitBatch","wait","sort","exec","scheduler","getScheduler","flush","pendingPromise","getBatchedArgs","setScheduler","promise","resolve","reject","call","batch","data_","factoryData","deploylessCallViaBytecode","deploylessCallViaFactory","deploylessCall","toDeploylessCallViaBytecodeData","toDeploylessCallViaFactoryData","shouldPerformMulticall","scheduleMulticall","response","getRevertErrorData","offchainLookup","offchainLookupSignature","request_","batchSize","multicallAddress_","multicallAddress","schedule","requests","calls","calldata","returnData","success","readContract","getEnsAddress","coinType","gatewayUrls","universalResolverAddress_","universalResolverAddress","functionData","readContractParameters","readContractAction","EnsAvatarInvalidMetadataError","EnsAvatarInvalidNftUriError","EnsAvatarUriResolutionError","uri","EnsAvatarUnsupportedNamespaceError","namespace","networkRegex","ipfsHashRegex","base64Regex","dataURIRegex","isImageUri","img","getGateway","custom","defaultGateway","resolveAvatarUri","isEncoded","ipfsGateway","arweaveGateway","networkRegexMatch","protocol","subpath","target","subtarget","isIPNS","isIPFS","replacedUri","parsedUri","getJsonImage","getMetadataAvatarUri","parseAvatarUri","resolvedURI","isOnChain","parseNftUri","uri_","reference","asset_namespace","tokenID","eip_namespace","chainID","erc_namespace","getNftTokenUri","nft","parseAvatarRecord","record","parseNftAvatarUri","nftUri","resolvedNftUri","encodedJson","decoded","uriTokenId","getEnsText","getEnsAvatar","assetGatewayUrls","getEnsName","reverseNode","resolvedAddress","promiseCache","responseCache","getCache","buildCache","cache","withCache","cacheTime","getBlockNumber","isAddressEqual","getTransaction","getTransactionReceipt","multicall","allowFailure","batchSize_","contracts","chunkedCalls","currentChunk","currentChunkSize","callData","aggregate3Results","results","aggregate3Result","listenersCache","cleanupCache","callbackCount","observe","observerId","callbacks","callbackId","getListeners","unsubscribe","listeners","cb","unwatch","cleanup","emit","listener","time","poll","emitOnBegin","initialWaitTime","interval","initialWait","watchBlockNumber","emitMissed","onBlockNumber","onError","poll_","pollingInterval","enablePolling","prevBlockNumber","transport","unsubscribe_","withDedupe","enabled","withRetry","delay_","retryCount","shouldRetry","attemptRetry","retry","delay","buildRequest","overrideOptions","dedupe","retryDelay","uid","requestId","err_","retryAfter","OffchainLookupError","callbackSelector","extraData","urls","OffchainLookupResponseMalformedError","OffchainLookupSenderMismatchError","offchainLookupAbiItem","ccipRead","ccipRequest_","ccipRequest","withTimeout","errorInstance","timeout","signal","timeoutId","controller","createIdStore","idCache","getHttpRpcClient","onRequest","onResponse","fetchOptions","signal_","init","InvalidDecimalNumberError","parseUnits","left","right","rounded","waitForTransactionReceipt","confirmations","onReplaced","replacedTransaction","retrying","_unobserve","_unwatch","blockNumber_","done","replacementTransaction","from","signMessage","message_","simulateContract","dataSuffix","callRequest","minimizedAbi","HMAC","_key","assertHash","buf","assertExists","assertBytes","oHash","iHash","hmac","abool","title","numberToHexUnpadded","num","asciis","asciiToBase16","hl","al","ai","hi","n1","n2","bytesToNumberBE","bytesToNumberLE","numberToBytesBE","numberToBytesLE","numberToVarBytesBE","ensureBytes","equalBytes","diff","isPosBig","inRange","aInRange","bitLen","bitGet","bitSet","bitMask","u8n","u8fr","createHmacDrbg","hashLen","qByteLen","hmacFn","reset","reseed","seed","sl","pred","validatorFns","object","validateObject","validators","optValidators","checkField","fieldName","isOptional","checkVal","notImplemented","memoized","map","computed","_3n","_4n","_5n","_8n","mod","pow","power","modulo","pow2","invert","u","tonelliShanks","P","legendreC","Q","S","Z","p1div4","Fp","root","Q1div2","t2","ge","FpSqrt","c1","nv","FIELD_FIELDS","validateField","field","initial","FpPow","FpInvertBatch","nums","lastMultiplied","inverted","nLength","nBitLength","_nBitLength","nByteLength","Field","ORDER","redef","BITS","BYTES","sqrtP","lhs","rhs","getFieldBytesLength","fieldOrder","bitLength","getMinHashLength","mapHashToField","fieldLen","minLen","reduced","pointPrecomputes","pointWindowSizes","wNAF","bits","constTimeNegate","condition","neg","validateW","W","windows","windowSize","elm","points","window","precomputes","mask","maxNumber","shiftBy","wbits","offset1","offset2","cond1","cond2","transform","comp","pippenger","scalars","MASK","buckets","lastBits","scalar","resI","sumI","validateBasic","curve","validateSigVerOpts","validatePointOpts","ut.validateObject","endo","b2n","h2b","ut","DER","tag","dataLen","ut.numberToHexUnpadded","lenLen","first","isLong","lengthBytes","int","tlv","ut.abytes","seqBytes","seqLeftBytes","rBytes","rLeftBytes","sBytes","sLeftBytes","seq","weierstrassPoints","CURVE","Fn","mod.Field","_c","point","_isCompressed","ut.concatBytes","fromBytes","weierstrassEquation","x2","x3","isWithinCurveOrder","ut.inRange","normPrivateKeyToScalar","wrapPrivateKey","N","ut.isBytes","ut.bytesToHex","ut.bytesToNumberBE","mod.mod","ut.aInRange","assertPrjPoint","other","Point","toAffineMemo","iz","z","is0","ax","ay","zz","assertValidMemo","px","py","pz","toInv","privateKey","wnaf","X1","Y1","Z1","X2","Y2","Z2","U1","U2","b3","X3","Y3","Z3","t0","t1","t3","t4","t5","sc","I","k1neg","k1","k2neg","k2","k1p","k2p","fake","f1p","f2p","mul","cofactor","isTorsionFree","clearCofactor","isCompressed","_bits","validateOpts","weierstrass","curveDef","CURVE_ORDER","compressedLen","uncompressedLen","modN","invN","mod.invert","cat","head","y2","sqrtError","isYOdd","numToNByteStr","ut.numberToBytesBE","isBiggerThanHalfOrder","HALF","normalizeS","slcNum","Signature","recovery","msgHash","rec","bits2int_modN","radj","prefix","ir","u1","u2","ut.hexToBytes","utils","mod.getMinHashLength","mod.mapHashToField","getPublicKey","isProbPub","getSharedSecret","privateA","publicB","bits2int","delta","ORDER_MASK","ut.bitMask","int2octets","prepSig","defaultSigOpts","lowS","prehash","ent","h1int","seedArgs","k2sig","kBytes","ik","normS","defaultVerOpts","sign","privKey","ut.createHmacDrbg","verify","sg","_sig","derError","is","getHash","msgs","createCurve","defHash","create","secp256k1P","secp256k1N","divNearest","sqrtMod","_6n","_11n","_22n","_23n","_44n","_88n","b2","b6","b9","b11","b22","b44","b88","b176","b220","b223","a1","b1","a2","POW_2_128","c2","writeContract","getVersion","__classPrivateFieldGet","receiver","kind","_BaseError_instances","_BaseError_walk","ChainNotConfiguredError","ConnectorAlreadyConnectedError","ConnectorNotConnectedError","ConnectorAccountNotFoundError","connector","ConnectorChainMismatchError","connectionChainId","connectorChainId","ConnectorUnavailableReconnectingError","connect","config","accounts","createClient","extend","extendFn","extended","combined","createTransport","uid_","provider","defaultRetryCount","fallback","transports_","rank","transports","fetch","shouldThrow","rankOptions","rankTransports","onTransports","sampleCount","weights","stabilityWeight","latencyWeight","samples","rankTransports_","sample","transport_","maxLatency","latency","scores","latencies","latencyScore","successes","stabilityScore","UrlRequiredError","http","onFetchRequest","onFetchResponse","retryCount_","timeout_","url_","rpcClient","getConnectorClient","connection","disconnect","connections","nextConnection","viem_estimateGas","getUnit","getAccount","addresses","viem_multicall","viem_readContract","readContracts","contractsByChainId","promises","multicallResults","resultIndexes","tokenAddress","getTokenBalance","symbol","viem_getBalance","balanceAddress","symbolType","deepEqual","previousConnections","getConnections","previousConnectors","getConnectors","connectors","viem_getEnsAddress","viem_getEnsAvatar","viem_getEnsName","viem_prepareTransactionRequest","isReconnecting","reconnect","connector_","recentConnectorId","sorted","connected","providers","gas_","activeConnector","viem_sendTransaction","viem_signMessage","action","viem_simulateContract","switchAccount","ProviderNotFoundError","SwitchChainNotSupportedError","switchChain","addEthereumChainParameter","watchAccount","onChange","aConnector","aRest","bConnector","bRest","watchChainId","watchConnections","watchConnectors","prevConnectors","viem_waitForTransactionReceipt","txn","__mode","simulateRequest","viem_writeContract","createConnector","createConnectorFn","supportsSimulationIdRegex","injected","shimDisconnect","unstable_shimAsyncInject","getTarget","targetMap","accountsChanged","chainChanged","hexChainId","findProvider","handleEthereum","blockExplorer","blockExplorers","blockExplorerUrls","rpcUrls","addEthereumChain","connectInfo","flags","flag","select","isProvider","ethereum","requestProviders","handler","event","createStore","providerDetails","providerDetail","info","rdns","emitImmediately","subscribeWithSelectorImpl","set","get","api","origSubscribe","selector","optListener","equalityFn","currentSlice","nextSlice","previousSlice","subscribeWithSelector","createJSONStorage","getStorage","storage","_a","parse","str2","newValue","toThenable","onFulfilled","_onRejected","_onFulfilled","onRejected","persistImpl","baseOptions","persistedState","currentState","hasHydrated","hydrationListeners","finishHydrationListeners","setItem","savedSetState","replace","configResult","stateFromStorage","hydrate","_b","_a2","postRehydrationCallback","deserializedStorageValue","migrationResult","migrated","migratedState","newOptions","persist","createStoreImpl","createState","setState","partial","nextState","previousState","getState","initialState","has","Events","EE","context","once","addListener","emitter","evt","clearEvent","EventEmitter","names","events","handlers","ee","a3","a4","a5","module","Emitter","createEmitter","deserialize","reviver","getReferenceKey","cutoff","getCutoff","createReplacer","circularReplacer","hasReplacer","hasCircularReplacer","thisCutoff","valueCutoff","serialize","indent","createStorage","deserialize_","serialize_","noopStorage","unwrap","defaultValue","unwrapped","storageKey","createConfig","multiInjectedProviderDiscovery","syncConnectedChain","ssr","mipd","createMipd","chains","collection","rdnsSet","connectorFns","setup","providerDetailToConnector","connectorFn","clients","getClient","store","chainIds","getInitialState","currentVersion","validatePersistedChainId","defaultChainId","connectorIdSet","connectorRdnsSet","newConnectors","change","newState","nextChains","reconnectOnMount","mipdConnectors","viem_fallback","Hydrate","children","onMount","useRef","useEffect","WagmiContext","createContext","WagmiProvider","props","createElement","CoreError","WagmiProviderNotFoundError","useConfig","useContext","useSyncExternalStoreShim_production_min","shimModule","require$$1","w","withSelector_production_min","withSelectorModule","isPlainObject","obj","useSyncExternalStoreWithTracked","subscribe","getSnapshot","getServerSnapshot","isEqual","trackedKeys","useSyncExternalStoreWithSelector","useMemo","trackedResult","useAccount","Subscribable","isServer","noop","functionalUpdate","updater","isValidTimeout","timeUntilStale","updatedAt","staleTime","resolveStaleTime","query","resolveEnabled","matchQuery","filters","exact","fetchStatus","predicate","queryKey","stale","hashQueryKeyByOptions","partialMatchKey","isActive","matchMutation","mutation","mutationKey","hashKey","replaceEqualDeep","isPlainArray","aItems","aSize","bItems","bSize","copy","equalItems","shallowEqualObjects","o","hasObjectPrototype","ctor","prot","sleep","replaceData","prevData","addToEnd","items","newItems","addToStart","skipToken","ensureQueryFn","FocusManager","__privateAdd","_focused","_cleanup","_setup","__privateSet","onFocus","__privateGet","focused","isFocused","focusManager","OnlineManager","_online","onOnline","onlineListener","offlineListener","online","onlineManager","pendingThenable","thenable","_resolve","_reject","finalize","defaultRetryDelay","failureCount","canFetch","networkMode","CancelledError","isCancelledError","createRetryer","isRetryCancelled","isResolved","continueFn","cancel","cancelOptions","cancelRetry","continueRetry","canContinue","canStart","pause","continueResolve","run","promiseOrValue","initialPromise","createNotifyManager","queue","notifyFn","callback","batchNotifyFn","scheduleFn","originalQueue","notifyManager","Removable","_gcTimeout","newGcTime","Query","_Query_instances","_initialState","_revertState","_cache","_retryer","_defaultOptions","_abortSignalConsumed","getDefaultState","newData","__privateMethod","dispatch_fn","setStateOptions","observer","abortController","addSignalProperty","fetchFn","queryFn","queryFnContext","reducer","fetchState","hasData","initialDataUpdatedAt","QueryCache","_queries","queryHash","queryInMap","defaultedFilters","queries","Mutation","_Mutation_instances","_observers","_mutationCache","variables","restored","isPaused","MutationCache","_mutations","_mutationId","__privateWrapper","scope","scopeFor","mutations","firstPendingMutation","pausedMutations","infiniteQueryBehavior","pages","direction","oldPages","oldPageParams","currentPage","cancelled","fetchPage","previous","page","maxPages","addTo","pageParamFn","getPreviousPageParam","getNextPageParam","oldData","remainingPages","pageParams","lastIndex","QueryClient","_queryCache","_queryDefaults","_mutationDefaults","_mountCount","_unsubscribeFocus","_unsubscribeOnline","cachedData","defaultedOptions","queryCache","refetchFilters","defaultedCancelOptions","defaults","queryDefault","MutationObserver","_MutationObserver_instances","_client","_currentResult","_currentMutation","_mutateOptions","updateResult_fn","prevOptions","notify_fn","disconnectMutationOptions","QueryClientContext","React.createContext","useQueryClient","queryClient","React.useContext","QueryClientProvider","React.useEffect","jsx","shouldThrowError","throwError","useMutation","React.useState","React.useSyncExternalStore","React.useCallback","onStoreChange","mutate","mutateOptions","useChainId","useSyncExternalStore","useConnections","useDisconnect","mutationOptions","mutateAsync"],"ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269],"sources":["../../../../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../../../../node_modules/react/jsx-runtime.js","../../../../../node_modules/viem/_esm/utils/chain/defineChain.js","../../../../../node_modules/viem/_esm/errors/version.js","../../../../../node_modules/viem/_esm/errors/base.js","../../../../../node_modules/viem/_esm/errors/encoding.js","../../../../../node_modules/viem/_esm/utils/data/isHex.js","../../../../../node_modules/viem/_esm/utils/data/size.js","../../../../../node_modules/viem/_esm/utils/data/trim.js","../../../../../node_modules/viem/_esm/errors/data.js","../../../../../node_modules/viem/_esm/utils/data/pad.js","../../../../../node_modules/viem/_esm/utils/encoding/toHex.js","../../../../../node_modules/viem/_esm/utils/encoding/toBytes.js","../../../../../node_modules/viem/_esm/utils/encoding/fromHex.js","../../../../../node_modules/viem/_esm/utils/formatters/transaction.js","../../../../../node_modules/viem/_esm/utils/formatters/block.js","../../../../../node_modules/viem/_esm/utils/formatters/log.js","../../../../../node_modules/viem/_esm/utils/formatters/transactionReceipt.js","../../../../../node_modules/viem/_esm/utils/formatters/transactionRequest.js","../../../../../node_modules/viem/_esm/constants/number.js","../../../../../node_modules/viem/_esm/utils/data/concat.js","../../../../../node_modules/viem/_esm/errors/cursor.js","../../../../../node_modules/viem/_esm/utils/cursor.js","../../../../../node_modules/viem/_esm/utils/encoding/toRlp.js","../../../../../node_modules/viem/_esm/constants/unit.js","../../../../../node_modules/viem/_esm/utils/unit/formatUnits.js","../../../../../node_modules/viem/_esm/utils/unit/formatEther.js","../../../../../node_modules/viem/_esm/utils/unit/formatGwei.js","../../../../../node_modules/viem/_esm/errors/transaction.js","../../../../../node_modules/viem/_esm/utils/blob/blobsToCommitments.js","../../../../../node_modules/viem/_esm/utils/blob/blobsToProofs.js","../../../../../node_modules/@noble/hashes/esm/_assert.js","../../../../../node_modules/@noble/hashes/esm/crypto.js","../../../../../node_modules/@noble/hashes/esm/utils.js","../../../../../node_modules/@noble/hashes/esm/_md.js","../../../../../node_modules/@noble/hashes/esm/sha256.js","../../../../../node_modules/viem/_esm/utils/hash/sha256.js","../../../../../node_modules/viem/_esm/utils/blob/commitmentToVersionedHash.js","../../../../../node_modules/viem/_esm/utils/blob/commitmentsToVersionedHashes.js","../../../../../node_modules/viem/_esm/constants/blob.js","../../../../../node_modules/viem/_esm/errors/blob.js","../../../../../node_modules/viem/_esm/utils/blob/toBlobs.js","../../../../../node_modules/viem/_esm/utils/blob/toBlobSidecars.js","../../../../../node_modules/viem/_esm/errors/address.js","../../../../../node_modules/viem/_esm/errors/chain.js","../../../../../node_modules/viem/_esm/errors/node.js","../../../../../node_modules/viem/_esm/utils/lru.js","../../../../../node_modules/@noble/hashes/esm/_u64.js","../../../../../node_modules/@noble/hashes/esm/sha3.js","../../../../../node_modules/viem/_esm/utils/hash/keccak256.js","../../../../../node_modules/viem/_esm/utils/address/getAddress.js","../../../../../node_modules/viem/_esm/utils/address/isAddress.js","../../../../../node_modules/viem/_esm/utils/data/slice.js","../../../../../node_modules/viem/_esm/utils/transaction/getTransactionType.js","../../../../../node_modules/viem/_esm/utils/chain/assertCurrentChain.js","../../../../../node_modules/viem/_esm/utils/chain/getChainContractAddress.js","../../../../../node_modules/viem/_esm/accounts/utils/parseAccount.js","../../../../../node_modules/viem/_esm/errors/fee.js","../../../../../node_modules/viem/_esm/utils/getAction.js","../../../../../node_modules/viem/_esm/errors/block.js","../../../../../node_modules/viem/_esm/actions/public/getBlock.js","../../../../../node_modules/viem/_esm/actions/public/getGasPrice.js","../../../../../node_modules/viem/_esm/actions/public/estimateMaxPriorityFeePerGas.js","../../../../../node_modules/viem/_esm/actions/public/estimateFeesPerGas.js","../../../../../node_modules/viem/_esm/accounts/utils/publicKeyToAddress.js","../../../../../node_modules/viem/_esm/utils/signature/recoverPublicKey.js","../../../../../node_modules/viem/_esm/utils/signature/recoverAddress.js","../../../../../node_modules/viem/_esm/experimental/eip7702/utils/hashAuthorization.js","../../../../../node_modules/viem/_esm/experimental/eip7702/utils/recoverAuthorizationAddress.js","../../../../../node_modules/viem/_esm/errors/estimateGas.js","../../../../../node_modules/viem/_esm/utils/stringify.js","../../../../../node_modules/viem/_esm/errors/utils.js","../../../../../node_modules/viem/_esm/errors/request.js","../../../../../node_modules/viem/_esm/errors/rpc.js","../../../../../node_modules/viem/_esm/utils/errors/getNodeError.js","../../../../../node_modules/viem/_esm/utils/errors/getEstimateGasError.js","../../../../../node_modules/viem/_esm/utils/formatters/extract.js","../../../../../node_modules/viem/_esm/errors/stateOverride.js","../../../../../node_modules/viem/_esm/utils/stateOverride.js","../../../../../node_modules/viem/_esm/utils/transaction/assertRequest.js","../../../../../node_modules/viem/_esm/actions/public/getBalance.js","../../../../../node_modules/viem/_esm/actions/public/estimateGas.js","../../../../../node_modules/viem/_esm/actions/public/getTransactionCount.js","../../../../../node_modules/viem/_esm/actions/public/getChainId.js","../../../../../node_modules/viem/_esm/actions/wallet/prepareTransactionRequest.js","../../../../../node_modules/viem/_esm/errors/account.js","../../../../../node_modules/viem/_esm/constants/solidity.js","../../../../../node_modules/viem/_esm/utils/abi/formatAbiItem.js","../../../../../node_modules/viem/_esm/errors/abi.js","../../../../../node_modules/viem/_esm/utils/hash/hashSignature.js","../../../../../node_modules/abitype/dist/esm/version.js","../../../../../node_modules/abitype/dist/esm/errors.js","../../../../../node_modules/abitype/dist/esm/regex.js","../../../../../node_modules/abitype/dist/esm/human-readable/formatAbiParameter.js","../../../../../node_modules/abitype/dist/esm/human-readable/formatAbiParameters.js","../../../../../node_modules/abitype/dist/esm/human-readable/formatAbiItem.js","../../../../../node_modules/abitype/dist/esm/human-readable/runtime/signatures.js","../../../../../node_modules/abitype/dist/esm/human-readable/errors/abiItem.js","../../../../../node_modules/abitype/dist/esm/human-readable/errors/abiParameter.js","../../../../../node_modules/abitype/dist/esm/human-readable/errors/signature.js","../../../../../node_modules/abitype/dist/esm/human-readable/errors/struct.js","../../../../../node_modules/abitype/dist/esm/human-readable/errors/splitParameters.js","../../../../../node_modules/abitype/dist/esm/human-readable/runtime/cache.js","../../../../../node_modules/abitype/dist/esm/human-readable/runtime/utils.js","../../../../../node_modules/abitype/dist/esm/human-readable/runtime/structs.js","../../../../../node_modules/abitype/dist/esm/human-readable/parseAbi.js","../../../../../node_modules/viem/_esm/utils/hash/normalizeSignature.js","../../../../../node_modules/viem/_esm/utils/hash/toSignature.js","../../../../../node_modules/viem/_esm/utils/hash/toSignatureHash.js","../../../../../node_modules/viem/_esm/utils/hash/toFunctionSelector.js","../../../../../node_modules/viem/_esm/utils/encoding/fromBytes.js","../../../../../node_modules/viem/_esm/utils/abi/encodeAbiParameters.js","../../../../../node_modules/viem/_esm/utils/abi/decodeAbiParameters.js","../../../../../node_modules/viem/_esm/utils/abi/decodeErrorResult.js","../../../../../node_modules/viem/_esm/utils/abi/formatAbiItemWithArgs.js","../../../../../node_modules/viem/_esm/utils/hash/toEventSelector.js","../../../../../node_modules/viem/_esm/utils/abi/getAbiItem.js","../../../../../node_modules/viem/_esm/errors/contract.js","../../../../../node_modules/viem/_esm/utils/errors/getCallError.js","../../../../../node_modules/viem/_esm/utils/abi/encodeDeployData.js","../../../../../node_modules/viem/_esm/utils/errors/getTransactionError.js","../../../../../node_modules/viem/_esm/actions/wallet/sendRawTransaction.js","../../../../../node_modules/viem/_esm/actions/wallet/sendTransaction.js","../../../../../node_modules/viem/_esm/constants/abis.js","../../../../../node_modules/viem/_esm/utils/abi/decodeFunctionResult.js","../../../../../node_modules/viem/_esm/utils/abi/prepareEncodeFunctionData.js","../../../../../node_modules/viem/_esm/utils/abi/encodeFunctionData.js","../../../../../node_modules/viem/_esm/utils/ens/errors.js","../../../../../node_modules/viem/_esm/utils/ens/encodedLabelToLabelhash.js","../../../../../node_modules/viem/_esm/utils/ens/namehash.js","../../../../../node_modules/viem/_esm/utils/ens/encodeLabelhash.js","../../../../../node_modules/viem/_esm/utils/ens/labelhash.js","../../../../../node_modules/viem/_esm/utils/ens/packetToBytes.js","../../../../../node_modules/viem/_esm/utils/errors/getContractError.js","../../../../../node_modules/viem/_esm/constants/contract.js","../../../../../node_modules/viem/_esm/constants/contracts.js","../../../../../node_modules/viem/_esm/utils/promise/createBatchScheduler.js","../../../../../node_modules/viem/_esm/actions/public/call.js","../../../../../node_modules/viem/_esm/actions/public/readContract.js","../../../../../node_modules/viem/_esm/actions/ens/getEnsAddress.js","../../../../../node_modules/viem/_esm/errors/ens.js","../../../../../node_modules/viem/_esm/utils/ens/avatar/utils.js","../../../../../node_modules/viem/_esm/utils/ens/avatar/parseAvatarRecord.js","../../../../../node_modules/viem/_esm/actions/ens/getEnsText.js","../../../../../node_modules/viem/_esm/actions/ens/getEnsAvatar.js","../../../../../node_modules/viem/_esm/actions/ens/getEnsName.js","../../../../../node_modules/viem/_esm/utils/promise/withCache.js","../../../../../node_modules/viem/_esm/actions/public/getBlockNumber.js","../../../../../node_modules/viem/_esm/utils/address/isAddressEqual.js","../../../../../node_modules/viem/_esm/actions/public/getTransaction.js","../../../../../node_modules/viem/_esm/actions/public/getTransactionReceipt.js","../../../../../node_modules/viem/_esm/actions/public/multicall.js","../../../../../node_modules/viem/_esm/utils/observe.js","../../../../../node_modules/viem/_esm/utils/wait.js","../../../../../node_modules/viem/_esm/utils/poll.js","../../../../../node_modules/viem/_esm/actions/public/watchBlockNumber.js","../../../../../node_modules/viem/_esm/utils/promise/withDedupe.js","../../../../../node_modules/viem/_esm/utils/promise/withRetry.js","../../../../../node_modules/viem/_esm/utils/buildRequest.js","../../../../../node_modules/viem/_esm/errors/ccip.js","../../../../../node_modules/viem/_esm/utils/ccip.js","../../../../../node_modules/viem/_esm/utils/promise/withTimeout.js","../../../../../node_modules/viem/_esm/utils/rpc/id.js","../../../../../node_modules/viem/_esm/utils/rpc/http.js","../../../../../node_modules/viem/_esm/errors/unit.js","../../../../../node_modules/viem/_esm/utils/unit/parseUnits.js","../../../../../node_modules/viem/_esm/actions/public/waitForTransactionReceipt.js","../../../../../node_modules/viem/_esm/actions/wallet/signMessage.js","../../../../../node_modules/viem/_esm/actions/public/simulateContract.js","../../../../../node_modules/@noble/hashes/esm/hmac.js","../../../../../node_modules/@noble/curves/esm/abstract/utils.js","../../../../../node_modules/@noble/curves/esm/abstract/modular.js","../../../../../node_modules/@noble/curves/esm/abstract/curve.js","../../../../../node_modules/@noble/curves/esm/abstract/weierstrass.js","../../../../../node_modules/@noble/curves/esm/_shortw_utils.js","../../../../../node_modules/@noble/curves/esm/secp256k1.js","../../../../../node_modules/viem/_esm/actions/wallet/writeContract.js","../../../../../node_modules/@wagmi/core/dist/esm/utils/getAction.js","../../../../../node_modules/@wagmi/core/dist/esm/version.js","../../../../../node_modules/@wagmi/core/dist/esm/utils/getVersion.js","../../../../../node_modules/@wagmi/core/dist/esm/errors/base.js","../../../../../node_modules/@wagmi/core/dist/esm/errors/config.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/connect.js","../../../../../node_modules/viem/_esm/utils/uid.js","../../../../../node_modules/viem/_esm/clients/createClient.js","../../../../../node_modules/viem/_esm/clients/transports/createTransport.js","../../../../../node_modules/viem/_esm/clients/transports/custom.js","../../../../../node_modules/viem/_esm/clients/transports/fallback.js","../../../../../node_modules/viem/_esm/errors/transport.js","../../../../../node_modules/viem/_esm/clients/transports/http.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/getConnectorClient.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/disconnect.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/estimateGas.js","../../../../../node_modules/@wagmi/core/dist/esm/utils/getUnit.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/getAccount.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/multicall.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/readContract.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/readContracts.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/getBalance.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/getChainId.js","../../../../../node_modules/@wagmi/core/dist/esm/utils/deepEqual.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/getConnections.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/getConnectors.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/getEnsAddress.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/getEnsAvatar.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/getEnsName.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/prepareTransactionRequest.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/reconnect.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/sendTransaction.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/signMessage.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/simulateContract.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/switchAccount.js","../../../../../node_modules/@wagmi/core/dist/esm/errors/connector.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/switchChain.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/watchAccount.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/watchChainId.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/watchConnections.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/watchConnectors.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/waitForTransactionReceipt.js","../../../../../node_modules/@wagmi/core/dist/esm/actions/writeContract.js","../../../../../node_modules/@wagmi/core/dist/esm/connectors/createConnector.js","../../../../../node_modules/@wagmi/core/dist/esm/connectors/injected.js","../../../../../node_modules/mipd/dist/esm/utils.js","../../../../../node_modules/mipd/dist/esm/store.js","../../../../../node_modules/@wagmi/core/node_modules/zustand/esm/middleware.mjs","../../../../../node_modules/@wagmi/core/node_modules/zustand/esm/vanilla.mjs","../../../../../node_modules/eventemitter3/index.js","../../../../../node_modules/@wagmi/core/dist/esm/createEmitter.js","../../../../../node_modules/@wagmi/core/dist/esm/utils/deserialize.js","../../../../../node_modules/@wagmi/core/dist/esm/utils/serialize.js","../../../../../node_modules/@wagmi/core/dist/esm/createStorage.js","../../../../../node_modules/@wagmi/core/dist/esm/utils/uid.js","../../../../../node_modules/@wagmi/core/dist/esm/createConfig.js","../../../../../node_modules/@wagmi/core/dist/esm/hydrate.js","../../../../../node_modules/@wagmi/core/dist/esm/transports/fallback.js","../../node_modules/wagmi/dist/esm/hydrate.js","../../node_modules/wagmi/dist/esm/context.js","../../node_modules/wagmi/dist/esm/version.js","../../node_modules/wagmi/dist/esm/utils/getVersion.js","../../node_modules/wagmi/dist/esm/errors/base.js","../../node_modules/wagmi/dist/esm/errors/context.js","../../node_modules/wagmi/dist/esm/hooks/useConfig.js","../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js","../../../../../node_modules/use-sync-external-store/shim/index.js","../../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js","../../../../../node_modules/use-sync-external-store/shim/with-selector.js","../../node_modules/wagmi/dist/esm/hooks/useSyncExternalStoreWithTracked.js","../../node_modules/wagmi/dist/esm/hooks/useAccount.js","../../../../../node_modules/@tanstack/query-core/build/modern/subscribable.js","../../../../../node_modules/@tanstack/query-core/build/modern/utils.js","../../../../../node_modules/@tanstack/query-core/build/modern/focusManager.js","../../../../../node_modules/@tanstack/query-core/build/modern/onlineManager.js","../../../../../node_modules/@tanstack/query-core/build/modern/thenable.js","../../../../../node_modules/@tanstack/query-core/build/modern/retryer.js","../../../../../node_modules/@tanstack/query-core/build/modern/notifyManager.js","../../../../../node_modules/@tanstack/query-core/build/modern/removable.js","../../../../../node_modules/@tanstack/query-core/build/modern/query.js","../../../../../node_modules/@tanstack/query-core/build/modern/queryCache.js","../../../../../node_modules/@tanstack/query-core/build/modern/mutation.js","../../../../../node_modules/@tanstack/query-core/build/modern/mutationCache.js","../../../../../node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js","../../../../../node_modules/@tanstack/query-core/build/modern/queryClient.js","../../../../../node_modules/@tanstack/query-core/build/modern/mutationObserver.js","../../../../../node_modules/@wagmi/core/dist/esm/query/disconnect.js","../../node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js","../../node_modules/@tanstack/react-query/build/modern/utils.js","../../node_modules/@tanstack/react-query/build/modern/useMutation.js","../../node_modules/wagmi/dist/esm/hooks/useChainId.js","../../node_modules/wagmi/dist/esm/hooks/useConnections.js","../../node_modules/wagmi/dist/esm/hooks/useDisconnect.js"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var f=require(\"react\"),k=Symbol.for(\"react.element\"),l=Symbol.for(\"react.fragment\"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=\"\"+g);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.min.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","export function defineChain(chain) {\n return {\n formatters: undefined,\n fees: undefined,\n serializers: undefined,\n ...chain,\n };\n}\n//# sourceMappingURL=defineChain.js.map","export const version = '2.21.32';\n//# sourceMappingURL=version.js.map","import { version } from './version.js';\nlet errorConfig = {\n getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath\n ? `${docsBaseUrl ?? 'https://viem.sh'}${docsPath}${docsSlug ? `#${docsSlug}` : ''}`\n : undefined,\n version: `viem@${version}`,\n};\nexport function setErrorConfig(config) {\n errorConfig = config;\n}\nexport class BaseError extends Error {\n constructor(shortMessage, args = {}) {\n const details = (() => {\n if (args.cause instanceof BaseError)\n return args.cause.details;\n if (args.cause?.message)\n return args.cause.message;\n return args.details;\n })();\n const docsPath = (() => {\n if (args.cause instanceof BaseError)\n return args.cause.docsPath || args.docsPath;\n return args.docsPath;\n })();\n const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath });\n const message = [\n shortMessage || 'An error occurred.',\n '',\n ...(args.metaMessages ? [...args.metaMessages, ''] : []),\n ...(docsUrl ? [`Docs: ${docsUrl}`] : []),\n ...(details ? [`Details: ${details}`] : []),\n ...(errorConfig.version ? [`Version: ${errorConfig.version}`] : []),\n ].join('\\n');\n super(message, args.cause ? { cause: args.cause } : undefined);\n Object.defineProperty(this, \"details\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"docsPath\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"metaMessages\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"shortMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"version\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'BaseError'\n });\n this.details = details;\n this.docsPath = docsPath;\n this.metaMessages = args.metaMessages;\n this.name = args.name ?? this.name;\n this.shortMessage = shortMessage;\n this.version = version;\n }\n walk(fn) {\n return walk(this, fn);\n }\n}\nfunction walk(err, fn) {\n if (fn?.(err))\n return err;\n if (err && typeof err === 'object' && 'cause' in err)\n return walk(err.cause, fn);\n return fn ? null : err;\n}\n//# sourceMappingURL=base.js.map","import { BaseError } from './base.js';\nexport class IntegerOutOfRangeError extends BaseError {\n constructor({ max, min, signed, size, value, }) {\n super(`Number \"${value}\" is not in safe ${size ? `${size * 8}-bit ${signed ? 'signed' : 'unsigned'} ` : ''}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: 'IntegerOutOfRangeError' });\n }\n}\nexport class InvalidBytesBooleanError extends BaseError {\n constructor(bytes) {\n super(`Bytes value \"${bytes}\" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, {\n name: 'InvalidBytesBooleanError',\n });\n }\n}\nexport class InvalidHexBooleanError extends BaseError {\n constructor(hex) {\n super(`Hex value \"${hex}\" is not a valid boolean. The hex value must be \"0x0\" (false) or \"0x1\" (true).`, { name: 'InvalidHexBooleanError' });\n }\n}\nexport class InvalidHexValueError extends BaseError {\n constructor(value) {\n super(`Hex value \"${value}\" is an odd length (${value.length}). It must be an even length.`, { name: 'InvalidHexValueError' });\n }\n}\nexport class SizeOverflowError extends BaseError {\n constructor({ givenSize, maxSize }) {\n super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: 'SizeOverflowError' });\n }\n}\n//# sourceMappingURL=encoding.js.map","export function isHex(value, { strict = true } = {}) {\n if (!value)\n return false;\n if (typeof value !== 'string')\n return false;\n return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith('0x');\n}\n//# sourceMappingURL=isHex.js.map","import { isHex } from './isHex.js';\n/**\n * @description Retrieves the size of the value (in bytes).\n *\n * @param value The value (hex or byte array) to retrieve the size of.\n * @returns The size of the value (in bytes).\n */\nexport function size(value) {\n if (isHex(value, { strict: false }))\n return Math.ceil((value.length - 2) / 2);\n return value.length;\n}\n//# sourceMappingURL=size.js.map","export function trim(hexOrBytes, { dir = 'left' } = {}) {\n let data = typeof hexOrBytes === 'string' ? hexOrBytes.replace('0x', '') : hexOrBytes;\n let sliceLength = 0;\n for (let i = 0; i < data.length - 1; i++) {\n if (data[dir === 'left' ? i : data.length - i - 1].toString() === '0')\n sliceLength++;\n else\n break;\n }\n data =\n dir === 'left'\n ? data.slice(sliceLength)\n : data.slice(0, data.length - sliceLength);\n if (typeof hexOrBytes === 'string') {\n if (data.length === 1 && dir === 'right')\n data = `${data}0`;\n return `0x${data.length % 2 === 1 ? `0${data}` : data}`;\n }\n return data;\n}\n//# sourceMappingURL=trim.js.map","import { BaseError } from './base.js';\nexport class SliceOffsetOutOfBoundsError extends BaseError {\n constructor({ offset, position, size, }) {\n super(`Slice ${position === 'start' ? 'starting' : 'ending'} at offset \"${offset}\" is out-of-bounds (size: ${size}).`, { name: 'SliceOffsetOutOfBoundsError' });\n }\n}\nexport class SizeExceedsPaddingSizeError extends BaseError {\n constructor({ size, targetSize, type, }) {\n super(`${type.charAt(0).toUpperCase()}${type\n .slice(1)\n .toLowerCase()} size (${size}) exceeds padding size (${targetSize}).`, { name: 'SizeExceedsPaddingSizeError' });\n }\n}\nexport class InvalidBytesLengthError extends BaseError {\n constructor({ size, targetSize, type, }) {\n super(`${type.charAt(0).toUpperCase()}${type\n .slice(1)\n .toLowerCase()} is expected to be ${targetSize} ${type} long, but is ${size} ${type} long.`, { name: 'InvalidBytesLengthError' });\n }\n}\n//# sourceMappingURL=data.js.map","import { SizeExceedsPaddingSizeError, } from '../../errors/data.js';\nexport function pad(hexOrBytes, { dir, size = 32 } = {}) {\n if (typeof hexOrBytes === 'string')\n return padHex(hexOrBytes, { dir, size });\n return padBytes(hexOrBytes, { dir, size });\n}\nexport function padHex(hex_, { dir, size = 32 } = {}) {\n if (size === null)\n return hex_;\n const hex = hex_.replace('0x', '');\n if (hex.length > size * 2)\n throw new SizeExceedsPaddingSizeError({\n size: Math.ceil(hex.length / 2),\n targetSize: size,\n type: 'hex',\n });\n return `0x${hex[dir === 'right' ? 'padEnd' : 'padStart'](size * 2, '0')}`;\n}\nexport function padBytes(bytes, { dir, size = 32 } = {}) {\n if (size === null)\n return bytes;\n if (bytes.length > size)\n throw new SizeExceedsPaddingSizeError({\n size: bytes.length,\n targetSize: size,\n type: 'bytes',\n });\n const paddedBytes = new Uint8Array(size);\n for (let i = 0; i < size; i++) {\n const padEnd = dir === 'right';\n paddedBytes[padEnd ? i : size - i - 1] =\n bytes[padEnd ? i : bytes.length - i - 1];\n }\n return paddedBytes;\n}\n//# sourceMappingURL=pad.js.map","import { IntegerOutOfRangeError, } from '../../errors/encoding.js';\nimport { pad } from '../data/pad.js';\nimport { assertSize } from './fromHex.js';\nconst hexes = /*#__PURE__*/ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, '0'));\n/**\n * Encodes a string, number, bigint, or ByteArray into a hex string\n *\n * - Docs: https://viem.sh/docs/utilities/toHex\n * - Example: https://viem.sh/docs/utilities/toHex#usage\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Hex value.\n *\n * @example\n * import { toHex } from 'viem'\n * const data = toHex('Hello world')\n * // '0x48656c6c6f20776f726c6421'\n *\n * @example\n * import { toHex } from 'viem'\n * const data = toHex(420)\n * // '0x1a4'\n *\n * @example\n * import { toHex } from 'viem'\n * const data = toHex('Hello world', { size: 32 })\n * // '0x48656c6c6f20776f726c64210000000000000000000000000000000000000000'\n */\nexport function toHex(value, opts = {}) {\n if (typeof value === 'number' || typeof value === 'bigint')\n return numberToHex(value, opts);\n if (typeof value === 'string') {\n return stringToHex(value, opts);\n }\n if (typeof value === 'boolean')\n return boolToHex(value, opts);\n return bytesToHex(value, opts);\n}\n/**\n * Encodes a boolean into a hex string\n *\n * - Docs: https://viem.sh/docs/utilities/toHex#booltohex\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Hex value.\n *\n * @example\n * import { boolToHex } from 'viem'\n * const data = boolToHex(true)\n * // '0x1'\n *\n * @example\n * import { boolToHex } from 'viem'\n * const data = boolToHex(false)\n * // '0x0'\n *\n * @example\n * import { boolToHex } from 'viem'\n * const data = boolToHex(true, { size: 32 })\n * // '0x0000000000000000000000000000000000000000000000000000000000000001'\n */\nexport function boolToHex(value, opts = {}) {\n const hex = `0x${Number(value)}`;\n if (typeof opts.size === 'number') {\n assertSize(hex, { size: opts.size });\n return pad(hex, { size: opts.size });\n }\n return hex;\n}\n/**\n * Encodes a bytes array into a hex string\n *\n * - Docs: https://viem.sh/docs/utilities/toHex#bytestohex\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Hex value.\n *\n * @example\n * import { bytesToHex } from 'viem'\n * const data = bytesToHex(Uint8Array.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])\n * // '0x48656c6c6f20576f726c6421'\n *\n * @example\n * import { bytesToHex } from 'viem'\n * const data = bytesToHex(Uint8Array.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]), { size: 32 })\n * // '0x48656c6c6f20576f726c64210000000000000000000000000000000000000000'\n */\nexport function bytesToHex(value, opts = {}) {\n let string = '';\n for (let i = 0; i < value.length; i++) {\n string += hexes[value[i]];\n }\n const hex = `0x${string}`;\n if (typeof opts.size === 'number') {\n assertSize(hex, { size: opts.size });\n return pad(hex, { dir: 'right', size: opts.size });\n }\n return hex;\n}\n/**\n * Encodes a number or bigint into a hex string\n *\n * - Docs: https://viem.sh/docs/utilities/toHex#numbertohex\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Hex value.\n *\n * @example\n * import { numberToHex } from 'viem'\n * const data = numberToHex(420)\n * // '0x1a4'\n *\n * @example\n * import { numberToHex } from 'viem'\n * const data = numberToHex(420, { size: 32 })\n * // '0x00000000000000000000000000000000000000000000000000000000000001a4'\n */\nexport function numberToHex(value_, opts = {}) {\n const { signed, size } = opts;\n const value = BigInt(value_);\n let maxValue;\n if (size) {\n if (signed)\n maxValue = (1n << (BigInt(size) * 8n - 1n)) - 1n;\n else\n maxValue = 2n ** (BigInt(size) * 8n) - 1n;\n }\n else if (typeof value_ === 'number') {\n maxValue = BigInt(Number.MAX_SAFE_INTEGER);\n }\n const minValue = typeof maxValue === 'bigint' && signed ? -maxValue - 1n : 0;\n if ((maxValue && value > maxValue) || value < minValue) {\n const suffix = typeof value_ === 'bigint' ? 'n' : '';\n throw new IntegerOutOfRangeError({\n max: maxValue ? `${maxValue}${suffix}` : undefined,\n min: `${minValue}${suffix}`,\n signed,\n size,\n value: `${value_}${suffix}`,\n });\n }\n const hex = `0x${(signed && value < 0 ? (1n << BigInt(size * 8)) + BigInt(value) : value).toString(16)}`;\n if (size)\n return pad(hex, { size });\n return hex;\n}\nconst encoder = /*#__PURE__*/ new TextEncoder();\n/**\n * Encodes a UTF-8 string into a hex string\n *\n * - Docs: https://viem.sh/docs/utilities/toHex#stringtohex\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Hex value.\n *\n * @example\n * import { stringToHex } from 'viem'\n * const data = stringToHex('Hello World!')\n * // '0x48656c6c6f20576f726c6421'\n *\n * @example\n * import { stringToHex } from 'viem'\n * const data = stringToHex('Hello World!', { size: 32 })\n * // '0x48656c6c6f20576f726c64210000000000000000000000000000000000000000'\n */\nexport function stringToHex(value_, opts = {}) {\n const value = encoder.encode(value_);\n return bytesToHex(value, opts);\n}\n//# sourceMappingURL=toHex.js.map","import { BaseError } from '../../errors/base.js';\nimport { isHex } from '../data/isHex.js';\nimport { pad } from '../data/pad.js';\nimport { assertSize } from './fromHex.js';\nimport { numberToHex, } from './toHex.js';\nconst encoder = /*#__PURE__*/ new TextEncoder();\n/**\n * Encodes a UTF-8 string, hex value, bigint, number or boolean to a byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/toBytes\n * - Example: https://viem.sh/docs/utilities/toBytes#usage\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Byte array value.\n *\n * @example\n * import { toBytes } from 'viem'\n * const data = toBytes('Hello world')\n * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])\n *\n * @example\n * import { toBytes } from 'viem'\n * const data = toBytes(420)\n * // Uint8Array([1, 164])\n *\n * @example\n * import { toBytes } from 'viem'\n * const data = toBytes(420, { size: 4 })\n * // Uint8Array([0, 0, 1, 164])\n */\nexport function toBytes(value, opts = {}) {\n if (typeof value === 'number' || typeof value === 'bigint')\n return numberToBytes(value, opts);\n if (typeof value === 'boolean')\n return boolToBytes(value, opts);\n if (isHex(value))\n return hexToBytes(value, opts);\n return stringToBytes(value, opts);\n}\n/**\n * Encodes a boolean into a byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/toBytes#booltobytes\n *\n * @param value Boolean value to encode.\n * @param opts Options.\n * @returns Byte array value.\n *\n * @example\n * import { boolToBytes } from 'viem'\n * const data = boolToBytes(true)\n * // Uint8Array([1])\n *\n * @example\n * import { boolToBytes } from 'viem'\n * const data = boolToBytes(true, { size: 32 })\n * // Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])\n */\nexport function boolToBytes(value, opts = {}) {\n const bytes = new Uint8Array(1);\n bytes[0] = Number(value);\n if (typeof opts.size === 'number') {\n assertSize(bytes, { size: opts.size });\n return pad(bytes, { size: opts.size });\n }\n return bytes;\n}\n// We use very optimized technique to convert hex string to byte array\nconst charCodeMap = {\n zero: 48,\n nine: 57,\n A: 65,\n F: 70,\n a: 97,\n f: 102,\n};\nfunction charCodeToBase16(char) {\n if (char >= charCodeMap.zero && char <= charCodeMap.nine)\n return char - charCodeMap.zero;\n if (char >= charCodeMap.A && char <= charCodeMap.F)\n return char - (charCodeMap.A - 10);\n if (char >= charCodeMap.a && char <= charCodeMap.f)\n return char - (charCodeMap.a - 10);\n return undefined;\n}\n/**\n * Encodes a hex string into a byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/toBytes#hextobytes\n *\n * @param hex Hex string to encode.\n * @param opts Options.\n * @returns Byte array value.\n *\n * @example\n * import { hexToBytes } from 'viem'\n * const data = hexToBytes('0x48656c6c6f20776f726c6421')\n * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])\n *\n * @example\n * import { hexToBytes } from 'viem'\n * const data = hexToBytes('0x48656c6c6f20776f726c6421', { size: 32 })\n * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])\n */\nexport function hexToBytes(hex_, opts = {}) {\n let hex = hex_;\n if (opts.size) {\n assertSize(hex, { size: opts.size });\n hex = pad(hex, { dir: 'right', size: opts.size });\n }\n let hexString = hex.slice(2);\n if (hexString.length % 2)\n hexString = `0${hexString}`;\n const length = hexString.length / 2;\n const bytes = new Uint8Array(length);\n for (let index = 0, j = 0; index < length; index++) {\n const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));\n const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));\n if (nibbleLeft === undefined || nibbleRight === undefined) {\n throw new BaseError(`Invalid byte sequence (\"${hexString[j - 2]}${hexString[j - 1]}\" in \"${hexString}\").`);\n }\n bytes[index] = nibbleLeft * 16 + nibbleRight;\n }\n return bytes;\n}\n/**\n * Encodes a number into a byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/toBytes#numbertobytes\n *\n * @param value Number to encode.\n * @param opts Options.\n * @returns Byte array value.\n *\n * @example\n * import { numberToBytes } from 'viem'\n * const data = numberToBytes(420)\n * // Uint8Array([1, 164])\n *\n * @example\n * import { numberToBytes } from 'viem'\n * const data = numberToBytes(420, { size: 4 })\n * // Uint8Array([0, 0, 1, 164])\n */\nexport function numberToBytes(value, opts) {\n const hex = numberToHex(value, opts);\n return hexToBytes(hex);\n}\n/**\n * Encodes a UTF-8 string into a byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/toBytes#stringtobytes\n *\n * @param value String to encode.\n * @param opts Options.\n * @returns Byte array value.\n *\n * @example\n * import { stringToBytes } from 'viem'\n * const data = stringToBytes('Hello world!')\n * // Uint8Array([72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33])\n *\n * @example\n * import { stringToBytes } from 'viem'\n * const data = stringToBytes('Hello world!', { size: 32 })\n * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])\n */\nexport function stringToBytes(value, opts = {}) {\n const bytes = encoder.encode(value);\n if (typeof opts.size === 'number') {\n assertSize(bytes, { size: opts.size });\n return pad(bytes, { dir: 'right', size: opts.size });\n }\n return bytes;\n}\n//# sourceMappingURL=toBytes.js.map","import { InvalidHexBooleanError, SizeOverflowError, } from '../../errors/encoding.js';\nimport { size as size_ } from '../data/size.js';\nimport { trim } from '../data/trim.js';\nimport { hexToBytes } from './toBytes.js';\nexport function assertSize(hexOrBytes, { size }) {\n if (size_(hexOrBytes) > size)\n throw new SizeOverflowError({\n givenSize: size_(hexOrBytes),\n maxSize: size,\n });\n}\n/**\n * Decodes a hex string into a string, number, bigint, boolean, or byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/fromHex\n * - Example: https://viem.sh/docs/utilities/fromHex#usage\n *\n * @param hex Hex string to decode.\n * @param toOrOpts Type to convert to or options.\n * @returns Decoded value.\n *\n * @example\n * import { fromHex } from 'viem'\n * const data = fromHex('0x1a4', 'number')\n * // 420\n *\n * @example\n * import { fromHex } from 'viem'\n * const data = fromHex('0x48656c6c6f20576f726c6421', 'string')\n * // 'Hello world'\n *\n * @example\n * import { fromHex } from 'viem'\n * const data = fromHex('0x48656c6c6f20576f726c64210000000000000000000000000000000000000000', {\n * size: 32,\n * to: 'string'\n * })\n * // 'Hello world'\n */\nexport function fromHex(hex, toOrOpts) {\n const opts = typeof toOrOpts === 'string' ? { to: toOrOpts } : toOrOpts;\n const to = opts.to;\n if (to === 'number')\n return hexToNumber(hex, opts);\n if (to === 'bigint')\n return hexToBigInt(hex, opts);\n if (to === 'string')\n return hexToString(hex, opts);\n if (to === 'boolean')\n return hexToBool(hex, opts);\n return hexToBytes(hex, opts);\n}\n/**\n * Decodes a hex value into a bigint.\n *\n * - Docs: https://viem.sh/docs/utilities/fromHex#hextobigint\n *\n * @param hex Hex value to decode.\n * @param opts Options.\n * @returns BigInt value.\n *\n * @example\n * import { hexToBigInt } from 'viem'\n * const data = hexToBigInt('0x1a4', { signed: true })\n * // 420n\n *\n * @example\n * import { hexToBigInt } from 'viem'\n * const data = hexToBigInt('0x00000000000000000000000000000000000000000000000000000000000001a4', { size: 32 })\n * // 420n\n */\nexport function hexToBigInt(hex, opts = {}) {\n const { signed } = opts;\n if (opts.size)\n assertSize(hex, { size: opts.size });\n const value = BigInt(hex);\n if (!signed)\n return value;\n const size = (hex.length - 2) / 2;\n const max = (1n << (BigInt(size) * 8n - 1n)) - 1n;\n if (value <= max)\n return value;\n return value - BigInt(`0x${'f'.padStart(size * 2, 'f')}`) - 1n;\n}\n/**\n * Decodes a hex value into a boolean.\n *\n * - Docs: https://viem.sh/docs/utilities/fromHex#hextobool\n *\n * @param hex Hex value to decode.\n * @param opts Options.\n * @returns Boolean value.\n *\n * @example\n * import { hexToBool } from 'viem'\n * const data = hexToBool('0x01')\n * // true\n *\n * @example\n * import { hexToBool } from 'viem'\n * const data = hexToBool('0x0000000000000000000000000000000000000000000000000000000000000001', { size: 32 })\n * // true\n */\nexport function hexToBool(hex_, opts = {}) {\n let hex = hex_;\n if (opts.size) {\n assertSize(hex, { size: opts.size });\n hex = trim(hex);\n }\n if (trim(hex) === '0x00')\n return false;\n if (trim(hex) === '0x01')\n return true;\n throw new InvalidHexBooleanError(hex);\n}\n/**\n * Decodes a hex string into a number.\n *\n * - Docs: https://viem.sh/docs/utilities/fromHex#hextonumber\n *\n * @param hex Hex value to decode.\n * @param opts Options.\n * @returns Number value.\n *\n * @example\n * import { hexToNumber } from 'viem'\n * const data = hexToNumber('0x1a4')\n * // 420\n *\n * @example\n * import { hexToNumber } from 'viem'\n * const data = hexToBigInt('0x00000000000000000000000000000000000000000000000000000000000001a4', { size: 32 })\n * // 420\n */\nexport function hexToNumber(hex, opts = {}) {\n return Number(hexToBigInt(hex, opts));\n}\n/**\n * Decodes a hex value into a UTF-8 string.\n *\n * - Docs: https://viem.sh/docs/utilities/fromHex#hextostring\n *\n * @param hex Hex value to decode.\n * @param opts Options.\n * @returns String value.\n *\n * @example\n * import { hexToString } from 'viem'\n * const data = hexToString('0x48656c6c6f20576f726c6421')\n * // 'Hello world!'\n *\n * @example\n * import { hexToString } from 'viem'\n * const data = hexToString('0x48656c6c6f20576f726c64210000000000000000000000000000000000000000', {\n * size: 32,\n * })\n * // 'Hello world'\n */\nexport function hexToString(hex, opts = {}) {\n let bytes = hexToBytes(hex);\n if (opts.size) {\n assertSize(bytes, { size: opts.size });\n bytes = trim(bytes, { dir: 'right' });\n }\n return new TextDecoder().decode(bytes);\n}\n//# sourceMappingURL=fromHex.js.map","import { hexToNumber } from '../encoding/fromHex.js';\nimport { defineFormatter } from './formatter.js';\nexport const transactionType = {\n '0x0': 'legacy',\n '0x1': 'eip2930',\n '0x2': 'eip1559',\n '0x3': 'eip4844',\n '0x4': 'eip7702',\n};\nexport function formatTransaction(transaction) {\n const transaction_ = {\n ...transaction,\n blockHash: transaction.blockHash ? transaction.blockHash : null,\n blockNumber: transaction.blockNumber\n ? BigInt(transaction.blockNumber)\n : null,\n chainId: transaction.chainId ? hexToNumber(transaction.chainId) : undefined,\n gas: transaction.gas ? BigInt(transaction.gas) : undefined,\n gasPrice: transaction.gasPrice ? BigInt(transaction.gasPrice) : undefined,\n maxFeePerBlobGas: transaction.maxFeePerBlobGas\n ? BigInt(transaction.maxFeePerBlobGas)\n : undefined,\n maxFeePerGas: transaction.maxFeePerGas\n ? BigInt(transaction.maxFeePerGas)\n : undefined,\n maxPriorityFeePerGas: transaction.maxPriorityFeePerGas\n ? BigInt(transaction.maxPriorityFeePerGas)\n : undefined,\n nonce: transaction.nonce ? hexToNumber(transaction.nonce) : undefined,\n to: transaction.to ? transaction.to : null,\n transactionIndex: transaction.transactionIndex\n ? Number(transaction.transactionIndex)\n : null,\n type: transaction.type\n ? transactionType[transaction.type]\n : undefined,\n typeHex: transaction.type ? transaction.type : undefined,\n value: transaction.value ? BigInt(transaction.value) : undefined,\n v: transaction.v ? BigInt(transaction.v) : undefined,\n };\n if (transaction.authorizationList)\n transaction_.authorizationList = formatAuthorizationList(transaction.authorizationList);\n transaction_.yParity = (() => {\n // If `yParity` is provided, we will use it.\n if (transaction.yParity)\n return Number(transaction.yParity);\n // If no `yParity` provided, try derive from `v`.\n if (typeof transaction_.v === 'bigint') {\n if (transaction_.v === 0n || transaction_.v === 27n)\n return 0;\n if (transaction_.v === 1n || transaction_.v === 28n)\n return 1;\n if (transaction_.v >= 35n)\n return transaction_.v % 2n === 0n ? 1 : 0;\n }\n return undefined;\n })();\n if (transaction_.type === 'legacy') {\n delete transaction_.accessList;\n delete transaction_.maxFeePerBlobGas;\n delete transaction_.maxFeePerGas;\n delete transaction_.maxPriorityFeePerGas;\n delete transaction_.yParity;\n }\n if (transaction_.type === 'eip2930') {\n delete transaction_.maxFeePerBlobGas;\n delete transaction_.maxFeePerGas;\n delete transaction_.maxPriorityFeePerGas;\n }\n if (transaction_.type === 'eip1559') {\n delete transaction_.maxFeePerBlobGas;\n }\n return transaction_;\n}\nexport const defineTransaction = /*#__PURE__*/ defineFormatter('transaction', formatTransaction);\n//////////////////////////////////////////////////////////////////////////////\nfunction formatAuthorizationList(authorizationList) {\n return authorizationList.map((authorization) => ({\n contractAddress: authorization.address,\n chainId: Number(authorization.chainId),\n nonce: Number(authorization.nonce),\n r: authorization.r,\n s: authorization.s,\n yParity: Number(authorization.yParity),\n }));\n}\n//# sourceMappingURL=transaction.js.map","import { defineFormatter } from './formatter.js';\nimport { formatTransaction } from './transaction.js';\nexport function formatBlock(block) {\n const transactions = block.transactions?.map((transaction) => {\n if (typeof transaction === 'string')\n return transaction;\n return formatTransaction(transaction);\n });\n return {\n ...block,\n baseFeePerGas: block.baseFeePerGas ? BigInt(block.baseFeePerGas) : null,\n blobGasUsed: block.blobGasUsed ? BigInt(block.blobGasUsed) : undefined,\n difficulty: block.difficulty ? BigInt(block.difficulty) : undefined,\n excessBlobGas: block.excessBlobGas\n ? BigInt(block.excessBlobGas)\n : undefined,\n gasLimit: block.gasLimit ? BigInt(block.gasLimit) : undefined,\n gasUsed: block.gasUsed ? BigInt(block.gasUsed) : undefined,\n hash: block.hash ? block.hash : null,\n logsBloom: block.logsBloom ? block.logsBloom : null,\n nonce: block.nonce ? block.nonce : null,\n number: block.number ? BigInt(block.number) : null,\n size: block.size ? BigInt(block.size) : undefined,\n timestamp: block.timestamp ? BigInt(block.timestamp) : undefined,\n transactions,\n totalDifficulty: block.totalDifficulty\n ? BigInt(block.totalDifficulty)\n : null,\n };\n}\nexport const defineBlock = /*#__PURE__*/ defineFormatter('block', formatBlock);\n//# sourceMappingURL=block.js.map","export function formatLog(log, { args, eventName, } = {}) {\n return {\n ...log,\n blockHash: log.blockHash ? log.blockHash : null,\n blockNumber: log.blockNumber ? BigInt(log.blockNumber) : null,\n logIndex: log.logIndex ? Number(log.logIndex) : null,\n transactionHash: log.transactionHash ? log.transactionHash : null,\n transactionIndex: log.transactionIndex\n ? Number(log.transactionIndex)\n : null,\n ...(eventName ? { args, eventName } : {}),\n };\n}\n//# sourceMappingURL=log.js.map","import { hexToNumber } from '../encoding/fromHex.js';\nimport { defineFormatter } from './formatter.js';\nimport { formatLog } from './log.js';\nimport { transactionType } from './transaction.js';\nexport const receiptStatuses = {\n '0x0': 'reverted',\n '0x1': 'success',\n};\nexport function formatTransactionReceipt(transactionReceipt) {\n const receipt = {\n ...transactionReceipt,\n blockNumber: transactionReceipt.blockNumber\n ? BigInt(transactionReceipt.blockNumber)\n : null,\n contractAddress: transactionReceipt.contractAddress\n ? transactionReceipt.contractAddress\n : null,\n cumulativeGasUsed: transactionReceipt.cumulativeGasUsed\n ? BigInt(transactionReceipt.cumulativeGasUsed)\n : null,\n effectiveGasPrice: transactionReceipt.effectiveGasPrice\n ? BigInt(transactionReceipt.effectiveGasPrice)\n : null,\n gasUsed: transactionReceipt.gasUsed\n ? BigInt(transactionReceipt.gasUsed)\n : null,\n logs: transactionReceipt.logs\n ? transactionReceipt.logs.map((log) => formatLog(log))\n : null,\n to: transactionReceipt.to ? transactionReceipt.to : null,\n transactionIndex: transactionReceipt.transactionIndex\n ? hexToNumber(transactionReceipt.transactionIndex)\n : null,\n status: transactionReceipt.status\n ? receiptStatuses[transactionReceipt.status]\n : null,\n type: transactionReceipt.type\n ? transactionType[transactionReceipt.type] || transactionReceipt.type\n : null,\n };\n if (transactionReceipt.blobGasPrice)\n receipt.blobGasPrice = BigInt(transactionReceipt.blobGasPrice);\n if (transactionReceipt.blobGasUsed)\n receipt.blobGasUsed = BigInt(transactionReceipt.blobGasUsed);\n return receipt;\n}\nexport const defineTransactionReceipt = /*#__PURE__*/ defineFormatter('transactionReceipt', formatTransactionReceipt);\n//# sourceMappingURL=transactionReceipt.js.map","import { bytesToHex, numberToHex } from '../encoding/toHex.js';\nimport { defineFormatter } from './formatter.js';\nexport const rpcTransactionType = {\n legacy: '0x0',\n eip2930: '0x1',\n eip1559: '0x2',\n eip4844: '0x3',\n eip7702: '0x4',\n};\nexport function formatTransactionRequest(request) {\n const rpcRequest = {};\n if (typeof request.authorizationList !== 'undefined')\n rpcRequest.authorizationList = formatAuthorizationList(request.authorizationList);\n if (typeof request.accessList !== 'undefined')\n rpcRequest.accessList = request.accessList;\n if (typeof request.blobVersionedHashes !== 'undefined')\n rpcRequest.blobVersionedHashes = request.blobVersionedHashes;\n if (typeof request.blobs !== 'undefined') {\n if (typeof request.blobs[0] !== 'string')\n rpcRequest.blobs = request.blobs.map((x) => bytesToHex(x));\n else\n rpcRequest.blobs = request.blobs;\n }\n if (typeof request.data !== 'undefined')\n rpcRequest.data = request.data;\n if (typeof request.from !== 'undefined')\n rpcRequest.from = request.from;\n if (typeof request.gas !== 'undefined')\n rpcRequest.gas = numberToHex(request.gas);\n if (typeof request.gasPrice !== 'undefined')\n rpcRequest.gasPrice = numberToHex(request.gasPrice);\n if (typeof request.maxFeePerBlobGas !== 'undefined')\n rpcRequest.maxFeePerBlobGas = numberToHex(request.maxFeePerBlobGas);\n if (typeof request.maxFeePerGas !== 'undefined')\n rpcRequest.maxFeePerGas = numberToHex(request.maxFeePerGas);\n if (typeof request.maxPriorityFeePerGas !== 'undefined')\n rpcRequest.maxPriorityFeePerGas = numberToHex(request.maxPriorityFeePerGas);\n if (typeof request.nonce !== 'undefined')\n rpcRequest.nonce = numberToHex(request.nonce);\n if (typeof request.to !== 'undefined')\n rpcRequest.to = request.to;\n if (typeof request.type !== 'undefined')\n rpcRequest.type = rpcTransactionType[request.type];\n if (typeof request.value !== 'undefined')\n rpcRequest.value = numberToHex(request.value);\n return rpcRequest;\n}\nexport const defineTransactionRequest = /*#__PURE__*/ defineFormatter('transactionRequest', formatTransactionRequest);\n//////////////////////////////////////////////////////////////////////////////\nfunction formatAuthorizationList(authorizationList) {\n return authorizationList.map((authorization) => ({\n address: authorization.contractAddress,\n r: authorization.r,\n s: authorization.s,\n chainId: numberToHex(authorization.chainId),\n nonce: numberToHex(authorization.nonce),\n ...(typeof authorization.yParity !== 'undefined'\n ? { yParity: numberToHex(authorization.yParity) }\n : {}),\n ...(typeof authorization.v !== 'undefined' &&\n typeof authorization.yParity === 'undefined'\n ? { v: numberToHex(authorization.v) }\n : {}),\n }));\n}\n//# sourceMappingURL=transactionRequest.js.map","export const maxInt8 = 2n ** (8n - 1n) - 1n;\nexport const maxInt16 = 2n ** (16n - 1n) - 1n;\nexport const maxInt24 = 2n ** (24n - 1n) - 1n;\nexport const maxInt32 = 2n ** (32n - 1n) - 1n;\nexport const maxInt40 = 2n ** (40n - 1n) - 1n;\nexport const maxInt48 = 2n ** (48n - 1n) - 1n;\nexport const maxInt56 = 2n ** (56n - 1n) - 1n;\nexport const maxInt64 = 2n ** (64n - 1n) - 1n;\nexport const maxInt72 = 2n ** (72n - 1n) - 1n;\nexport const maxInt80 = 2n ** (80n - 1n) - 1n;\nexport const maxInt88 = 2n ** (88n - 1n) - 1n;\nexport const maxInt96 = 2n ** (96n - 1n) - 1n;\nexport const maxInt104 = 2n ** (104n - 1n) - 1n;\nexport const maxInt112 = 2n ** (112n - 1n) - 1n;\nexport const maxInt120 = 2n ** (120n - 1n) - 1n;\nexport const maxInt128 = 2n ** (128n - 1n) - 1n;\nexport const maxInt136 = 2n ** (136n - 1n) - 1n;\nexport const maxInt144 = 2n ** (144n - 1n) - 1n;\nexport const maxInt152 = 2n ** (152n - 1n) - 1n;\nexport const maxInt160 = 2n ** (160n - 1n) - 1n;\nexport const maxInt168 = 2n ** (168n - 1n) - 1n;\nexport const maxInt176 = 2n ** (176n - 1n) - 1n;\nexport const maxInt184 = 2n ** (184n - 1n) - 1n;\nexport const maxInt192 = 2n ** (192n - 1n) - 1n;\nexport const maxInt200 = 2n ** (200n - 1n) - 1n;\nexport const maxInt208 = 2n ** (208n - 1n) - 1n;\nexport const maxInt216 = 2n ** (216n - 1n) - 1n;\nexport const maxInt224 = 2n ** (224n - 1n) - 1n;\nexport const maxInt232 = 2n ** (232n - 1n) - 1n;\nexport const maxInt240 = 2n ** (240n - 1n) - 1n;\nexport const maxInt248 = 2n ** (248n - 1n) - 1n;\nexport const maxInt256 = 2n ** (256n - 1n) - 1n;\nexport const minInt8 = -(2n ** (8n - 1n));\nexport const minInt16 = -(2n ** (16n - 1n));\nexport const minInt24 = -(2n ** (24n - 1n));\nexport const minInt32 = -(2n ** (32n - 1n));\nexport const minInt40 = -(2n ** (40n - 1n));\nexport const minInt48 = -(2n ** (48n - 1n));\nexport const minInt56 = -(2n ** (56n - 1n));\nexport const minInt64 = -(2n ** (64n - 1n));\nexport const minInt72 = -(2n ** (72n - 1n));\nexport const minInt80 = -(2n ** (80n - 1n));\nexport const minInt88 = -(2n ** (88n - 1n));\nexport const minInt96 = -(2n ** (96n - 1n));\nexport const minInt104 = -(2n ** (104n - 1n));\nexport const minInt112 = -(2n ** (112n - 1n));\nexport const minInt120 = -(2n ** (120n - 1n));\nexport const minInt128 = -(2n ** (128n - 1n));\nexport const minInt136 = -(2n ** (136n - 1n));\nexport const minInt144 = -(2n ** (144n - 1n));\nexport const minInt152 = -(2n ** (152n - 1n));\nexport const minInt160 = -(2n ** (160n - 1n));\nexport const minInt168 = -(2n ** (168n - 1n));\nexport const minInt176 = -(2n ** (176n - 1n));\nexport const minInt184 = -(2n ** (184n - 1n));\nexport const minInt192 = -(2n ** (192n - 1n));\nexport const minInt200 = -(2n ** (200n - 1n));\nexport const minInt208 = -(2n ** (208n - 1n));\nexport const minInt216 = -(2n ** (216n - 1n));\nexport const minInt224 = -(2n ** (224n - 1n));\nexport const minInt232 = -(2n ** (232n - 1n));\nexport const minInt240 = -(2n ** (240n - 1n));\nexport const minInt248 = -(2n ** (248n - 1n));\nexport const minInt256 = -(2n ** (256n - 1n));\nexport const maxUint8 = 2n ** 8n - 1n;\nexport const maxUint16 = 2n ** 16n - 1n;\nexport const maxUint24 = 2n ** 24n - 1n;\nexport const maxUint32 = 2n ** 32n - 1n;\nexport const maxUint40 = 2n ** 40n - 1n;\nexport const maxUint48 = 2n ** 48n - 1n;\nexport const maxUint56 = 2n ** 56n - 1n;\nexport const maxUint64 = 2n ** 64n - 1n;\nexport const maxUint72 = 2n ** 72n - 1n;\nexport const maxUint80 = 2n ** 80n - 1n;\nexport const maxUint88 = 2n ** 88n - 1n;\nexport const maxUint96 = 2n ** 96n - 1n;\nexport const maxUint104 = 2n ** 104n - 1n;\nexport const maxUint112 = 2n ** 112n - 1n;\nexport const maxUint120 = 2n ** 120n - 1n;\nexport const maxUint128 = 2n ** 128n - 1n;\nexport const maxUint136 = 2n ** 136n - 1n;\nexport const maxUint144 = 2n ** 144n - 1n;\nexport const maxUint152 = 2n ** 152n - 1n;\nexport const maxUint160 = 2n ** 160n - 1n;\nexport const maxUint168 = 2n ** 168n - 1n;\nexport const maxUint176 = 2n ** 176n - 1n;\nexport const maxUint184 = 2n ** 184n - 1n;\nexport const maxUint192 = 2n ** 192n - 1n;\nexport const maxUint200 = 2n ** 200n - 1n;\nexport const maxUint208 = 2n ** 208n - 1n;\nexport const maxUint216 = 2n ** 216n - 1n;\nexport const maxUint224 = 2n ** 224n - 1n;\nexport const maxUint232 = 2n ** 232n - 1n;\nexport const maxUint240 = 2n ** 240n - 1n;\nexport const maxUint248 = 2n ** 248n - 1n;\nexport const maxUint256 = 2n ** 256n - 1n;\n//# sourceMappingURL=number.js.map","export function concat(values) {\n if (typeof values[0] === 'string')\n return concatHex(values);\n return concatBytes(values);\n}\nexport function concatBytes(values) {\n let length = 0;\n for (const arr of values) {\n length += arr.length;\n }\n const result = new Uint8Array(length);\n let offset = 0;\n for (const arr of values) {\n result.set(arr, offset);\n offset += arr.length;\n }\n return result;\n}\nexport function concatHex(values) {\n return `0x${values.reduce((acc, x) => acc + x.replace('0x', ''), '')}`;\n}\n//# sourceMappingURL=concat.js.map","import { BaseError } from './base.js';\nexport class NegativeOffsetError extends BaseError {\n constructor({ offset }) {\n super(`Offset \\`${offset}\\` cannot be negative.`, {\n name: 'NegativeOffsetError',\n });\n }\n}\nexport class PositionOutOfBoundsError extends BaseError {\n constructor({ length, position }) {\n super(`Position \\`${position}\\` is out of bounds (\\`0 < position < ${length}\\`).`, { name: 'PositionOutOfBoundsError' });\n }\n}\nexport class RecursiveReadLimitExceededError extends BaseError {\n constructor({ count, limit }) {\n super(`Recursive read limit of \\`${limit}\\` exceeded (recursive read count: \\`${count}\\`).`, { name: 'RecursiveReadLimitExceededError' });\n }\n}\n//# sourceMappingURL=cursor.js.map","import { NegativeOffsetError, PositionOutOfBoundsError, RecursiveReadLimitExceededError, } from '../errors/cursor.js';\nconst staticCursor = {\n bytes: new Uint8Array(),\n dataView: new DataView(new ArrayBuffer(0)),\n position: 0,\n positionReadCount: new Map(),\n recursiveReadCount: 0,\n recursiveReadLimit: Number.POSITIVE_INFINITY,\n assertReadLimit() {\n if (this.recursiveReadCount >= this.recursiveReadLimit)\n throw new RecursiveReadLimitExceededError({\n count: this.recursiveReadCount + 1,\n limit: this.recursiveReadLimit,\n });\n },\n assertPosition(position) {\n if (position < 0 || position > this.bytes.length - 1)\n throw new PositionOutOfBoundsError({\n length: this.bytes.length,\n position,\n });\n },\n decrementPosition(offset) {\n if (offset < 0)\n throw new NegativeOffsetError({ offset });\n const position = this.position - offset;\n this.assertPosition(position);\n this.position = position;\n },\n getReadCount(position) {\n return this.positionReadCount.get(position || this.position) || 0;\n },\n incrementPosition(offset) {\n if (offset < 0)\n throw new NegativeOffsetError({ offset });\n const position = this.position + offset;\n this.assertPosition(position);\n this.position = position;\n },\n inspectByte(position_) {\n const position = position_ ?? this.position;\n this.assertPosition(position);\n return this.bytes[position];\n },\n inspectBytes(length, position_) {\n const position = position_ ?? this.position;\n this.assertPosition(position + length - 1);\n return this.bytes.subarray(position, position + length);\n },\n inspectUint8(position_) {\n const position = position_ ?? this.position;\n this.assertPosition(position);\n return this.bytes[position];\n },\n inspectUint16(position_) {\n const position = position_ ?? this.position;\n this.assertPosition(position + 1);\n return this.dataView.getUint16(position);\n },\n inspectUint24(position_) {\n const position = position_ ?? this.position;\n this.assertPosition(position + 2);\n return ((this.dataView.getUint16(position) << 8) +\n this.dataView.getUint8(position + 2));\n },\n inspectUint32(position_) {\n const position = position_ ?? this.position;\n this.assertPosition(position + 3);\n return this.dataView.getUint32(position);\n },\n pushByte(byte) {\n this.assertPosition(this.position);\n this.bytes[this.position] = byte;\n this.position++;\n },\n pushBytes(bytes) {\n this.assertPosition(this.position + bytes.length - 1);\n this.bytes.set(bytes, this.position);\n this.position += bytes.length;\n },\n pushUint8(value) {\n this.assertPosition(this.position);\n this.bytes[this.position] = value;\n this.position++;\n },\n pushUint16(value) {\n this.assertPosition(this.position + 1);\n this.dataView.setUint16(this.position, value);\n this.position += 2;\n },\n pushUint24(value) {\n this.assertPosition(this.position + 2);\n this.dataView.setUint16(this.position, value >> 8);\n this.dataView.setUint8(this.position + 2, value & ~4294967040);\n this.position += 3;\n },\n pushUint32(value) {\n this.assertPosition(this.position + 3);\n this.dataView.setUint32(this.position, value);\n this.position += 4;\n },\n readByte() {\n this.assertReadLimit();\n this._touch();\n const value = this.inspectByte();\n this.position++;\n return value;\n },\n readBytes(length, size) {\n this.assertReadLimit();\n this._touch();\n const value = this.inspectBytes(length);\n this.position += size ?? length;\n return value;\n },\n readUint8() {\n this.assertReadLimit();\n this._touch();\n const value = this.inspectUint8();\n this.position += 1;\n return value;\n },\n readUint16() {\n this.assertReadLimit();\n this._touch();\n const value = this.inspectUint16();\n this.position += 2;\n return value;\n },\n readUint24() {\n this.assertReadLimit();\n this._touch();\n const value = this.inspectUint24();\n this.position += 3;\n return value;\n },\n readUint32() {\n this.assertReadLimit();\n this._touch();\n const value = this.inspectUint32();\n this.position += 4;\n return value;\n },\n get remaining() {\n return this.bytes.length - this.position;\n },\n setPosition(position) {\n const oldPosition = this.position;\n this.assertPosition(position);\n this.position = position;\n return () => (this.position = oldPosition);\n },\n _touch() {\n if (this.recursiveReadLimit === Number.POSITIVE_INFINITY)\n return;\n const count = this.getReadCount();\n this.positionReadCount.set(this.position, count + 1);\n if (count > 0)\n this.recursiveReadCount++;\n },\n};\nexport function createCursor(bytes, { recursiveReadLimit = 8_192 } = {}) {\n const cursor = Object.create(staticCursor);\n cursor.bytes = bytes;\n cursor.dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n cursor.positionReadCount = new Map();\n cursor.recursiveReadLimit = recursiveReadLimit;\n return cursor;\n}\n//# sourceMappingURL=cursor.js.map","import { BaseError } from '../../errors/base.js';\nimport { createCursor, } from '../cursor.js';\nimport { hexToBytes } from './toBytes.js';\nimport { bytesToHex } from './toHex.js';\nexport function toRlp(bytes, to = 'hex') {\n const encodable = getEncodable(bytes);\n const cursor = createCursor(new Uint8Array(encodable.length));\n encodable.encode(cursor);\n if (to === 'hex')\n return bytesToHex(cursor.bytes);\n return cursor.bytes;\n}\nexport function bytesToRlp(bytes, to = 'bytes') {\n return toRlp(bytes, to);\n}\nexport function hexToRlp(hex, to = 'hex') {\n return toRlp(hex, to);\n}\nfunction getEncodable(bytes) {\n if (Array.isArray(bytes))\n return getEncodableList(bytes.map((x) => getEncodable(x)));\n return getEncodableBytes(bytes);\n}\nfunction getEncodableList(list) {\n const bodyLength = list.reduce((acc, x) => acc + x.length, 0);\n const sizeOfBodyLength = getSizeOfLength(bodyLength);\n const length = (() => {\n if (bodyLength <= 55)\n return 1 + bodyLength;\n return 1 + sizeOfBodyLength + bodyLength;\n })();\n return {\n length,\n encode(cursor) {\n if (bodyLength <= 55) {\n cursor.pushByte(0xc0 + bodyLength);\n }\n else {\n cursor.pushByte(0xc0 + 55 + sizeOfBodyLength);\n if (sizeOfBodyLength === 1)\n cursor.pushUint8(bodyLength);\n else if (sizeOfBodyLength === 2)\n cursor.pushUint16(bodyLength);\n else if (sizeOfBodyLength === 3)\n cursor.pushUint24(bodyLength);\n else\n cursor.pushUint32(bodyLength);\n }\n for (const { encode } of list) {\n encode(cursor);\n }\n },\n };\n}\nfunction getEncodableBytes(bytesOrHex) {\n const bytes = typeof bytesOrHex === 'string' ? hexToBytes(bytesOrHex) : bytesOrHex;\n const sizeOfBytesLength = getSizeOfLength(bytes.length);\n const length = (() => {\n if (bytes.length === 1 && bytes[0] < 0x80)\n return 1;\n if (bytes.length <= 55)\n return 1 + bytes.length;\n return 1 + sizeOfBytesLength + bytes.length;\n })();\n return {\n length,\n encode(cursor) {\n if (bytes.length === 1 && bytes[0] < 0x80) {\n cursor.pushBytes(bytes);\n }\n else if (bytes.length <= 55) {\n cursor.pushByte(0x80 + bytes.length);\n cursor.pushBytes(bytes);\n }\n else {\n cursor.pushByte(0x80 + 55 + sizeOfBytesLength);\n if (sizeOfBytesLength === 1)\n cursor.pushUint8(bytes.length);\n else if (sizeOfBytesLength === 2)\n cursor.pushUint16(bytes.length);\n else if (sizeOfBytesLength === 3)\n cursor.pushUint24(bytes.length);\n else\n cursor.pushUint32(bytes.length);\n cursor.pushBytes(bytes);\n }\n },\n };\n}\nfunction getSizeOfLength(length) {\n if (length < 2 ** 8)\n return 1;\n if (length < 2 ** 16)\n return 2;\n if (length < 2 ** 24)\n return 3;\n if (length < 2 ** 32)\n return 4;\n throw new BaseError('Length is too large.');\n}\n//# sourceMappingURL=toRlp.js.map","export const etherUnits = {\n gwei: 9,\n wei: 18,\n};\nexport const gweiUnits = {\n ether: -9,\n wei: 9,\n};\nexport const weiUnits = {\n ether: -18,\n gwei: -9,\n};\n//# sourceMappingURL=unit.js.map","/**\n * Divides a number by a given exponent of base 10 (10exponent), and formats it into a string representation of the number..\n *\n * - Docs: https://viem.sh/docs/utilities/formatUnits\n *\n * @example\n * import { formatUnits } from 'viem'\n *\n * formatUnits(420000000000n, 9)\n * // '420'\n */\nexport function formatUnits(value, decimals) {\n let display = value.toString();\n const negative = display.startsWith('-');\n if (negative)\n display = display.slice(1);\n display = display.padStart(decimals, '0');\n let [integer, fraction] = [\n display.slice(0, display.length - decimals),\n display.slice(display.length - decimals),\n ];\n fraction = fraction.replace(/(0+)$/, '');\n return `${negative ? '-' : ''}${integer || '0'}${fraction ? `.${fraction}` : ''}`;\n}\n//# sourceMappingURL=formatUnits.js.map","import { etherUnits } from '../../constants/unit.js';\nimport { formatUnits } from './formatUnits.js';\n/**\n * Converts numerical wei to a string representation of ether.\n *\n * - Docs: https://viem.sh/docs/utilities/formatEther\n *\n * @example\n * import { formatEther } from 'viem'\n *\n * formatEther(1000000000000000000n)\n * // '1'\n */\nexport function formatEther(wei, unit = 'wei') {\n return formatUnits(wei, etherUnits[unit]);\n}\n//# sourceMappingURL=formatEther.js.map","import { gweiUnits } from '../../constants/unit.js';\nimport { formatUnits } from './formatUnits.js';\n/**\n * Converts numerical wei to a string representation of gwei.\n *\n * - Docs: https://viem.sh/docs/utilities/formatGwei\n *\n * @example\n * import { formatGwei } from 'viem'\n *\n * formatGwei(1000000000n)\n * // '1'\n */\nexport function formatGwei(wei, unit = 'wei') {\n return formatUnits(wei, gweiUnits[unit]);\n}\n//# sourceMappingURL=formatGwei.js.map","import { formatEther } from '../utils/unit/formatEther.js';\nimport { formatGwei } from '../utils/unit/formatGwei.js';\nimport { BaseError } from './base.js';\nexport function prettyPrint(args) {\n const entries = Object.entries(args)\n .map(([key, value]) => {\n if (value === undefined || value === false)\n return null;\n return [key, value];\n })\n .filter(Boolean);\n const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0);\n return entries\n .map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`)\n .join('\\n');\n}\nexport class FeeConflictError extends BaseError {\n constructor() {\n super([\n 'Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.',\n 'Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others.',\n ].join('\\n'), { name: 'FeeConflictError' });\n }\n}\nexport class InvalidLegacyVError extends BaseError {\n constructor({ v }) {\n super(`Invalid \\`v\\` value \"${v}\". Expected 27 or 28.`, {\n name: 'InvalidLegacyVError',\n });\n }\n}\nexport class InvalidSerializableTransactionError extends BaseError {\n constructor({ transaction }) {\n super('Cannot infer a transaction type from provided transaction.', {\n metaMessages: [\n 'Provided Transaction:',\n '{',\n prettyPrint(transaction),\n '}',\n '',\n 'To infer the type, either provide:',\n '- a `type` to the Transaction, or',\n '- an EIP-1559 Transaction with `maxFeePerGas`, or',\n '- an EIP-2930 Transaction with `gasPrice` & `accessList`, or',\n '- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or',\n '- an EIP-7702 Transaction with `authorizationList`, or',\n '- a Legacy Transaction with `gasPrice`',\n ],\n name: 'InvalidSerializableTransactionError',\n });\n }\n}\nexport class InvalidSerializedTransactionTypeError extends BaseError {\n constructor({ serializedType }) {\n super(`Serialized transaction type \"${serializedType}\" is invalid.`, {\n name: 'InvalidSerializedTransactionType',\n });\n Object.defineProperty(this, \"serializedType\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.serializedType = serializedType;\n }\n}\nexport class InvalidSerializedTransactionError extends BaseError {\n constructor({ attributes, serializedTransaction, type, }) {\n const missing = Object.entries(attributes)\n .map(([key, value]) => (typeof value === 'undefined' ? key : undefined))\n .filter(Boolean);\n super(`Invalid serialized transaction of type \"${type}\" was provided.`, {\n metaMessages: [\n `Serialized Transaction: \"${serializedTransaction}\"`,\n missing.length > 0 ? `Missing Attributes: ${missing.join(', ')}` : '',\n ].filter(Boolean),\n name: 'InvalidSerializedTransactionError',\n });\n Object.defineProperty(this, \"serializedTransaction\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"type\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.serializedTransaction = serializedTransaction;\n this.type = type;\n }\n}\nexport class InvalidStorageKeySizeError extends BaseError {\n constructor({ storageKey }) {\n super(`Size for storage key \"${storageKey}\" is invalid. Expected 32 bytes. Got ${Math.floor((storageKey.length - 2) / 2)} bytes.`, { name: 'InvalidStorageKeySizeError' });\n }\n}\nexport class TransactionExecutionError extends BaseError {\n constructor(cause, { account, docsPath, chain, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, }) {\n const prettyArgs = prettyPrint({\n chain: chain && `${chain?.name} (id: ${chain?.id})`,\n from: account?.address,\n to,\n value: typeof value !== 'undefined' &&\n `${formatEther(value)} ${chain?.nativeCurrency?.symbol || 'ETH'}`,\n data,\n gas,\n gasPrice: typeof gasPrice !== 'undefined' && `${formatGwei(gasPrice)} gwei`,\n maxFeePerGas: typeof maxFeePerGas !== 'undefined' &&\n `${formatGwei(maxFeePerGas)} gwei`,\n maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== 'undefined' &&\n `${formatGwei(maxPriorityFeePerGas)} gwei`,\n nonce,\n });\n super(cause.shortMessage, {\n cause,\n docsPath,\n metaMessages: [\n ...(cause.metaMessages ? [...cause.metaMessages, ' '] : []),\n 'Request Arguments:',\n prettyArgs,\n ].filter(Boolean),\n name: 'TransactionExecutionError',\n });\n Object.defineProperty(this, \"cause\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.cause = cause;\n }\n}\nexport class TransactionNotFoundError extends BaseError {\n constructor({ blockHash, blockNumber, blockTag, hash, index, }) {\n let identifier = 'Transaction';\n if (blockTag && index !== undefined)\n identifier = `Transaction at block time \"${blockTag}\" at index \"${index}\"`;\n if (blockHash && index !== undefined)\n identifier = `Transaction at block hash \"${blockHash}\" at index \"${index}\"`;\n if (blockNumber && index !== undefined)\n identifier = `Transaction at block number \"${blockNumber}\" at index \"${index}\"`;\n if (hash)\n identifier = `Transaction with hash \"${hash}\"`;\n super(`${identifier} could not be found.`, {\n name: 'TransactionNotFoundError',\n });\n }\n}\nexport class TransactionReceiptNotFoundError extends BaseError {\n constructor({ hash }) {\n super(`Transaction receipt with hash \"${hash}\" could not be found. The Transaction may not be processed on a block yet.`, {\n name: 'TransactionReceiptNotFoundError',\n });\n }\n}\nexport class WaitForTransactionReceiptTimeoutError extends BaseError {\n constructor({ hash }) {\n super(`Timed out while waiting for transaction with hash \"${hash}\" to be confirmed.`, { name: 'WaitForTransactionReceiptTimeoutError' });\n }\n}\n//# sourceMappingURL=transaction.js.map","import { hexToBytes } from '../encoding/toBytes.js';\nimport { bytesToHex } from '../encoding/toHex.js';\n/**\n * Compute commitments from a list of blobs.\n *\n * @example\n * ```ts\n * import { blobsToCommitments, toBlobs } from 'viem'\n * import { kzg } from './kzg'\n *\n * const blobs = toBlobs({ data: '0x1234' })\n * const commitments = blobsToCommitments({ blobs, kzg })\n * ```\n */\nexport function blobsToCommitments(parameters) {\n const { kzg } = parameters;\n const to = parameters.to ?? (typeof parameters.blobs[0] === 'string' ? 'hex' : 'bytes');\n const blobs = (typeof parameters.blobs[0] === 'string'\n ? parameters.blobs.map((x) => hexToBytes(x))\n : parameters.blobs);\n const commitments = [];\n for (const blob of blobs)\n commitments.push(Uint8Array.from(kzg.blobToKzgCommitment(blob)));\n return (to === 'bytes'\n ? commitments\n : commitments.map((x) => bytesToHex(x)));\n}\n//# sourceMappingURL=blobsToCommitments.js.map","import { hexToBytes } from '../encoding/toBytes.js';\nimport { bytesToHex } from '../encoding/toHex.js';\n/**\n * Compute the proofs for a list of blobs and their commitments.\n *\n * @example\n * ```ts\n * import {\n * blobsToCommitments,\n * toBlobs\n * } from 'viem'\n * import { kzg } from './kzg'\n *\n * const blobs = toBlobs({ data: '0x1234' })\n * const commitments = blobsToCommitments({ blobs, kzg })\n * const proofs = blobsToProofs({ blobs, commitments, kzg })\n * ```\n */\nexport function blobsToProofs(parameters) {\n const { kzg } = parameters;\n const to = parameters.to ?? (typeof parameters.blobs[0] === 'string' ? 'hex' : 'bytes');\n const blobs = (typeof parameters.blobs[0] === 'string'\n ? parameters.blobs.map((x) => hexToBytes(x))\n : parameters.blobs);\n const commitments = (typeof parameters.commitments[0] === 'string'\n ? parameters.commitments.map((x) => hexToBytes(x))\n : parameters.commitments);\n const proofs = [];\n for (let i = 0; i < blobs.length; i++) {\n const blob = blobs[i];\n const commitment = commitments[i];\n proofs.push(Uint8Array.from(kzg.computeBlobKzgProof(blob, commitment)));\n }\n return (to === 'bytes'\n ? proofs\n : proofs.map((x) => bytesToHex(x)));\n}\n//# sourceMappingURL=blobsToProofs.js.map","function number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`positive integer expected, not ${n}`);\n}\nfunction bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`boolean expected, not ${b}`);\n}\n// copied from utils\nexport function isBytes(a) {\n return (a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array'));\n}\nfunction bytes(b, ...lengths) {\n if (!isBytes(b))\n throw new Error('Uint8Array expected');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);\n}\nfunction hash(h) {\n if (typeof h !== 'function' || typeof h.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(h.outputLen);\n number(h.blockLen);\n}\nfunction exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nfunction output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\nexport { number, bool, bytes, hash, exists, output };\nconst assert = { number, bool, bytes, hash, exists, output };\nexport default assert;\n//# sourceMappingURL=_assert.js.map","export const crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;\n//# sourceMappingURL=crypto.js.map","/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\nimport { bytes as abytes } from './_assert.js';\n// export { isBytes } from './_assert.js';\n// We can't reuse isBytes from _assert, because somehow this causes huge perf issues\nexport function isBytes(a) {\n return (a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array'));\n}\n// Cast array to different type\nexport const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n// Cast array to view\nexport const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);\n// The rotate left (circular left shift) operation for uint32\nexport const rotl = (word, shift) => (word << shift) | ((word >>> (32 - shift)) >>> 0);\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\n// The byte swap operation for uint32\nexport const byteSwap = (word) => ((word << 24) & 0xff000000) |\n ((word << 8) & 0xff0000) |\n ((word >>> 8) & 0xff00) |\n ((word >>> 24) & 0xff);\n// Conditionally byte swap if on a big-endian platform\nexport const byteSwapIfBE = isLE ? (n) => n : (n) => byteSwap(n);\n// In place byte swap for Uint32Array\nexport function byteSwap32(arr) {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = byteSwap(arr[i]);\n }\n}\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n abytes(bytes);\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 };\nfunction asciiToBase16(char) {\n if (char >= asciis._0 && char <= asciis._9)\n return char - asciis._0;\n if (char >= asciis._A && char <= asciis._F)\n return char - (asciis._A - 10);\n if (char >= asciis._a && char <= asciis._f)\n return char - (asciis._a - 10);\n return;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2;\n }\n return array;\n}\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => { };\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n abytes(data);\n return data;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays) {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n// For runtime check if class implements interface\nexport class Hash {\n // Safe version that clones internal state\n clone() {\n return this._cloneInto();\n }\n}\nconst toStr = {}.toString;\nexport function checkOpts(defaults, opts) {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nexport function wrapConstructor(hashCons) {\n const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\nexport function wrapConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nexport function wrapXOFConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32) {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n // Legacy Node.js compatibility\n if (crypto && typeof crypto.randomBytes === 'function') {\n return crypto.randomBytes(bytesLength);\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n//# sourceMappingURL=utils.js.map","import { exists, output } from './_assert.js';\nimport { Hash, createView, toBytes } from './utils.js';\n/**\n * Polyfill for Safari 14\n */\nfunction setBigUint64(view, byteOffset, value, isLE) {\n if (typeof view.setBigUint64 === 'function')\n return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n/**\n * Choice: a ? b : c\n */\nexport const Chi = (a, b, c) => (a & b) ^ (~a & c);\n/**\n * Majority function, true if any two inputs is true\n */\nexport const Maj = (a, b, c) => (a & b) ^ (a & c) ^ (b & c);\n/**\n * Merkle-Damgard hash construction base class.\n * Could be used to create MD5, RIPEMD, SHA1, SHA2.\n */\nexport class HashMD extends Hash {\n constructor(blockLen, outputLen, padOffset, isLE) {\n super();\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.finished = false;\n this.length = 0;\n this.pos = 0;\n this.destroyed = false;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data) {\n exists(this);\n const { view, buffer, blockLen } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n exists(this);\n output(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n this.buffer.subarray(pos).fill(0);\n // we have less than padOffset left in buffer, so we cannot put length in\n // current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length)\n throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to || (to = new this.constructor());\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.length = length;\n to.pos = pos;\n to.finished = finished;\n to.destroyed = destroyed;\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n}\n//# sourceMappingURL=_md.js.map","import { HashMD, Chi, Maj } from './_md.js';\nimport { rotr, wrapConstructor } from './utils.js';\n// SHA2-256 need to try 2^128 hashes to execute birthday attack.\n// BTC network is doing 2^67 hashes/sec as per early 2023.\n// Round constants:\n// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n// Initial state:\n// first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19\n// prettier-ignore\nconst SHA256_IV = /* @__PURE__ */ new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n]);\n// Temporary buffer, not used to store anything between runs\n// Named this way because it matches specification.\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\nexport class SHA256 extends HashMD {\n constructor() {\n super(64, 32, 8, false);\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n this.A = SHA256_IV[0] | 0;\n this.B = SHA256_IV[1] | 0;\n this.C = SHA256_IV[2] | 0;\n this.D = SHA256_IV[3] | 0;\n this.E = SHA256_IV[4] | 0;\n this.F = SHA256_IV[5] | 0;\n this.G = SHA256_IV[6] | 0;\n this.H = SHA256_IV[7] | 0;\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4)\n SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n SHA256_W.fill(0);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n this.buffer.fill(0);\n }\n}\n// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf\nclass SHA224 extends SHA256 {\n constructor() {\n super();\n this.A = 0xc1059ed8 | 0;\n this.B = 0x367cd507 | 0;\n this.C = 0x3070dd17 | 0;\n this.D = 0xf70e5939 | 0;\n this.E = 0xffc00b31 | 0;\n this.F = 0x68581511 | 0;\n this.G = 0x64f98fa7 | 0;\n this.H = 0xbefa4fa4 | 0;\n this.outputLen = 28;\n }\n}\n/**\n * SHA2-256 hash function\n * @param message - data that would be hashed\n */\nexport const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());\n/**\n * SHA2-224 hash function\n */\nexport const sha224 = /* @__PURE__ */ wrapConstructor(() => new SHA224());\n//# sourceMappingURL=sha256.js.map","import { sha256 as noble_sha256 } from '@noble/hashes/sha256';\nimport { isHex } from '../data/isHex.js';\nimport { toBytes } from '../encoding/toBytes.js';\nimport { toHex } from '../encoding/toHex.js';\nexport function sha256(value, to_) {\n const to = to_ || 'hex';\n const bytes = noble_sha256(isHex(value, { strict: false }) ? toBytes(value) : value);\n if (to === 'bytes')\n return bytes;\n return toHex(bytes);\n}\n//# sourceMappingURL=sha256.js.map","import { bytesToHex } from '../encoding/toHex.js';\nimport { sha256 } from '../hash/sha256.js';\n/**\n * Transform a commitment to it's versioned hash.\n *\n * @example\n * ```ts\n * import {\n * blobsToCommitments,\n * commitmentToVersionedHash,\n * toBlobs\n * } from 'viem'\n * import { kzg } from './kzg'\n *\n * const blobs = toBlobs({ data: '0x1234' })\n * const [commitment] = blobsToCommitments({ blobs, kzg })\n * const versionedHash = commitmentToVersionedHash({ commitment })\n * ```\n */\nexport function commitmentToVersionedHash(parameters) {\n const { commitment, version = 1 } = parameters;\n const to = parameters.to ?? (typeof commitment === 'string' ? 'hex' : 'bytes');\n const versionedHash = sha256(commitment, 'bytes');\n versionedHash.set([version], 0);\n return (to === 'bytes' ? versionedHash : bytesToHex(versionedHash));\n}\n//# sourceMappingURL=commitmentToVersionedHash.js.map","import { commitmentToVersionedHash, } from './commitmentToVersionedHash.js';\n/**\n * Transform a list of commitments to their versioned hashes.\n *\n * @example\n * ```ts\n * import {\n * blobsToCommitments,\n * commitmentsToVersionedHashes,\n * toBlobs\n * } from 'viem'\n * import { kzg } from './kzg'\n *\n * const blobs = toBlobs({ data: '0x1234' })\n * const commitments = blobsToCommitments({ blobs, kzg })\n * const versionedHashes = commitmentsToVersionedHashes({ commitments })\n * ```\n */\nexport function commitmentsToVersionedHashes(parameters) {\n const { commitments, version } = parameters;\n const to = parameters.to ?? (typeof commitments[0] === 'string' ? 'hex' : 'bytes');\n const hashes = [];\n for (const commitment of commitments) {\n hashes.push(commitmentToVersionedHash({\n commitment,\n to,\n version,\n }));\n }\n return hashes;\n}\n//# sourceMappingURL=commitmentsToVersionedHashes.js.map","// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4844.md#parameters\n/** Blob limit per transaction. */\nconst blobsPerTransaction = 6;\n/** The number of bytes in a BLS scalar field element. */\nexport const bytesPerFieldElement = 32;\n/** The number of field elements in a blob. */\nexport const fieldElementsPerBlob = 4096;\n/** The number of bytes in a blob. */\nexport const bytesPerBlob = bytesPerFieldElement * fieldElementsPerBlob;\n/** Blob bytes limit per transaction. */\nexport const maxBytesPerTransaction = bytesPerBlob * blobsPerTransaction -\n // terminator byte (0x80).\n 1 -\n // zero byte (0x00) appended to each field element.\n 1 * fieldElementsPerBlob * blobsPerTransaction;\n//# sourceMappingURL=blob.js.map","import { versionedHashVersionKzg } from '../constants/kzg.js';\nimport { BaseError } from './base.js';\nexport class BlobSizeTooLargeError extends BaseError {\n constructor({ maxSize, size }) {\n super('Blob size is too large.', {\n metaMessages: [`Max: ${maxSize} bytes`, `Given: ${size} bytes`],\n name: 'BlobSizeTooLargeError',\n });\n }\n}\nexport class EmptyBlobError extends BaseError {\n constructor() {\n super('Blob data must not be empty.', { name: 'EmptyBlobError' });\n }\n}\nexport class InvalidVersionedHashSizeError extends BaseError {\n constructor({ hash, size, }) {\n super(`Versioned hash \"${hash}\" size is invalid.`, {\n metaMessages: ['Expected: 32', `Received: ${size}`],\n name: 'InvalidVersionedHashSizeError',\n });\n }\n}\nexport class InvalidVersionedHashVersionError extends BaseError {\n constructor({ hash, version, }) {\n super(`Versioned hash \"${hash}\" version is invalid.`, {\n metaMessages: [\n `Expected: ${versionedHashVersionKzg}`,\n `Received: ${version}`,\n ],\n name: 'InvalidVersionedHashVersionError',\n });\n }\n}\n//# sourceMappingURL=blob.js.map","import { bytesPerBlob, bytesPerFieldElement, fieldElementsPerBlob, maxBytesPerTransaction, } from '../../constants/blob.js';\nimport { BlobSizeTooLargeError, EmptyBlobError, } from '../../errors/blob.js';\nimport { createCursor } from '../cursor.js';\nimport { size } from '../data/size.js';\nimport { hexToBytes } from '../encoding/toBytes.js';\nimport { bytesToHex } from '../encoding/toHex.js';\n/**\n * Transforms arbitrary data to blobs.\n *\n * @example\n * ```ts\n * import { toBlobs, stringToHex } from 'viem'\n *\n * const blobs = toBlobs({ data: stringToHex('hello world') })\n * ```\n */\nexport function toBlobs(parameters) {\n const to = parameters.to ?? (typeof parameters.data === 'string' ? 'hex' : 'bytes');\n const data = (typeof parameters.data === 'string'\n ? hexToBytes(parameters.data)\n : parameters.data);\n const size_ = size(data);\n if (!size_)\n throw new EmptyBlobError();\n if (size_ > maxBytesPerTransaction)\n throw new BlobSizeTooLargeError({\n maxSize: maxBytesPerTransaction,\n size: size_,\n });\n const blobs = [];\n let active = true;\n let position = 0;\n while (active) {\n const blob = createCursor(new Uint8Array(bytesPerBlob));\n let size = 0;\n while (size < fieldElementsPerBlob) {\n const bytes = data.slice(position, position + (bytesPerFieldElement - 1));\n // Push a zero byte so the field element doesn't overflow the BLS modulus.\n blob.pushByte(0x00);\n // Push the current segment of data bytes.\n blob.pushBytes(bytes);\n // If we detect that the current segment of data bytes is less than 31 bytes,\n // we can stop processing and push a terminator byte to indicate the end of the blob.\n if (bytes.length < 31) {\n blob.pushByte(0x80);\n active = false;\n break;\n }\n size++;\n position += 31;\n }\n blobs.push(blob);\n }\n return (to === 'bytes'\n ? blobs.map((x) => x.bytes)\n : blobs.map((x) => bytesToHex(x.bytes)));\n}\n//# sourceMappingURL=toBlobs.js.map","import { blobsToCommitments, } from './blobsToCommitments.js';\nimport { blobsToProofs } from './blobsToProofs.js';\nimport { toBlobs } from './toBlobs.js';\n/**\n * Transforms arbitrary data (or blobs, commitments, & proofs) into a sidecar array.\n *\n * @example\n * ```ts\n * import { toBlobSidecars, stringToHex } from 'viem'\n *\n * const sidecars = toBlobSidecars({ data: stringToHex('hello world') })\n * ```\n *\n * @example\n * ```ts\n * import {\n * blobsToCommitments,\n * toBlobs,\n * blobsToProofs,\n * toBlobSidecars,\n * stringToHex\n * } from 'viem'\n *\n * const blobs = toBlobs({ data: stringToHex('hello world') })\n * const commitments = blobsToCommitments({ blobs, kzg })\n * const proofs = blobsToProofs({ blobs, commitments, kzg })\n *\n * const sidecars = toBlobSidecars({ blobs, commitments, proofs })\n * ```\n */\nexport function toBlobSidecars(parameters) {\n const { data, kzg, to } = parameters;\n const blobs = parameters.blobs ?? toBlobs({ data: data, to });\n const commitments = parameters.commitments ?? blobsToCommitments({ blobs, kzg: kzg, to });\n const proofs = parameters.proofs ?? blobsToProofs({ blobs, commitments, kzg: kzg, to });\n const sidecars = [];\n for (let i = 0; i < blobs.length; i++)\n sidecars.push({\n blob: blobs[i],\n commitment: commitments[i],\n proof: proofs[i],\n });\n return sidecars;\n}\n//# sourceMappingURL=toBlobSidecars.js.map","import { BaseError } from './base.js';\nexport class InvalidAddressError extends BaseError {\n constructor({ address }) {\n super(`Address \"${address}\" is invalid.`, {\n metaMessages: [\n '- Address must be a hex value of 20 bytes (40 hex characters).',\n '- Address must match its checksum counterpart.',\n ],\n name: 'InvalidAddressError',\n });\n }\n}\n//# sourceMappingURL=address.js.map","import { BaseError } from './base.js';\nexport class ChainDoesNotSupportContract extends BaseError {\n constructor({ blockNumber, chain, contract, }) {\n super(`Chain \"${chain.name}\" does not support contract \"${contract.name}\".`, {\n metaMessages: [\n 'This could be due to any of the following:',\n ...(blockNumber &&\n contract.blockCreated &&\n contract.blockCreated > blockNumber\n ? [\n `- The contract \"${contract.name}\" was not deployed until block ${contract.blockCreated} (current block ${blockNumber}).`,\n ]\n : [\n `- The chain does not have the contract \"${contract.name}\" configured.`,\n ]),\n ],\n name: 'ChainDoesNotSupportContract',\n });\n }\n}\nexport class ChainMismatchError extends BaseError {\n constructor({ chain, currentChainId, }) {\n super(`The current chain of the wallet (id: ${currentChainId}) does not match the target chain for the transaction (id: ${chain.id} – ${chain.name}).`, {\n metaMessages: [\n `Current Chain ID: ${currentChainId}`,\n `Expected Chain ID: ${chain.id} – ${chain.name}`,\n ],\n name: 'ChainMismatchError',\n });\n }\n}\nexport class ChainNotFoundError extends BaseError {\n constructor() {\n super([\n 'No chain was provided to the request.',\n 'Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient.',\n ].join('\\n'), {\n name: 'ChainNotFoundError',\n });\n }\n}\nexport class ClientChainNotConfiguredError extends BaseError {\n constructor() {\n super('No chain was provided to the Client.', {\n name: 'ClientChainNotConfiguredError',\n });\n }\n}\nexport class InvalidChainIdError extends BaseError {\n constructor({ chainId }) {\n super(typeof chainId === 'number'\n ? `Chain ID \"${chainId}\" is invalid.`\n : 'Chain ID is invalid.', { name: 'InvalidChainIdError' });\n }\n}\n//# sourceMappingURL=chain.js.map","import { formatGwei } from '../utils/unit/formatGwei.js';\nimport { BaseError } from './base.js';\nexport class ExecutionRevertedError extends BaseError {\n constructor({ cause, message, } = {}) {\n const reason = message\n ?.replace('execution reverted: ', '')\n ?.replace('execution reverted', '');\n super(`Execution reverted ${reason ? `with reason: ${reason}` : 'for an unknown reason'}.`, {\n cause,\n name: 'ExecutionRevertedError',\n });\n }\n}\nObject.defineProperty(ExecutionRevertedError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 3\n});\nObject.defineProperty(ExecutionRevertedError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /execution reverted/\n});\nexport class FeeCapTooHighError extends BaseError {\n constructor({ cause, maxFeePerGas, } = {}) {\n super(`The fee cap (\\`maxFeePerGas\\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ''}) cannot be higher than the maximum allowed value (2^256-1).`, {\n cause,\n name: 'FeeCapTooHighError',\n });\n }\n}\nObject.defineProperty(FeeCapTooHighError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /max fee per gas higher than 2\\^256-1|fee cap higher than 2\\^256-1/\n});\nexport class FeeCapTooLowError extends BaseError {\n constructor({ cause, maxFeePerGas, } = {}) {\n super(`The fee cap (\\`maxFeePerGas\\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)}` : ''} gwei) cannot be lower than the block base fee.`, {\n cause,\n name: 'FeeCapTooLowError',\n });\n }\n}\nObject.defineProperty(FeeCapTooLowError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/\n});\nexport class NonceTooHighError extends BaseError {\n constructor({ cause, nonce, } = {}) {\n super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ''}is higher than the next one expected.`, { cause, name: 'NonceTooHighError' });\n }\n}\nObject.defineProperty(NonceTooHighError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /nonce too high/\n});\nexport class NonceTooLowError extends BaseError {\n constructor({ cause, nonce, } = {}) {\n super([\n `Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ''}is lower than the current nonce of the account.`,\n 'Try increasing the nonce or find the latest nonce with `getTransactionCount`.',\n ].join('\\n'), { cause, name: 'NonceTooLowError' });\n }\n}\nObject.defineProperty(NonceTooLowError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /nonce too low|transaction already imported|already known/\n});\nexport class NonceMaxValueError extends BaseError {\n constructor({ cause, nonce, } = {}) {\n super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ''}exceeds the maximum allowed nonce.`, { cause, name: 'NonceMaxValueError' });\n }\n}\nObject.defineProperty(NonceMaxValueError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /nonce has max value/\n});\nexport class InsufficientFundsError extends BaseError {\n constructor({ cause } = {}) {\n super([\n 'The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account.',\n ].join('\\n'), {\n cause,\n metaMessages: [\n 'This error could arise when the account does not have enough funds to:',\n ' - pay for the total gas fee,',\n ' - pay for the value to send.',\n ' ',\n 'The cost of the transaction is calculated as `gas * gas fee + value`, where:',\n ' - `gas` is the amount of gas needed for transaction to execute,',\n ' - `gas fee` is the gas fee,',\n ' - `value` is the amount of ether to send to the recipient.',\n ],\n name: 'InsufficientFundsError',\n });\n }\n}\nObject.defineProperty(InsufficientFundsError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /insufficient funds|exceeds transaction sender account balance/\n});\nexport class IntrinsicGasTooHighError extends BaseError {\n constructor({ cause, gas, } = {}) {\n super(`The amount of gas ${gas ? `(${gas}) ` : ''}provided for the transaction exceeds the limit allowed for the block.`, {\n cause,\n name: 'IntrinsicGasTooHighError',\n });\n }\n}\nObject.defineProperty(IntrinsicGasTooHighError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /intrinsic gas too high|gas limit reached/\n});\nexport class IntrinsicGasTooLowError extends BaseError {\n constructor({ cause, gas, } = {}) {\n super(`The amount of gas ${gas ? `(${gas}) ` : ''}provided for the transaction is too low.`, {\n cause,\n name: 'IntrinsicGasTooLowError',\n });\n }\n}\nObject.defineProperty(IntrinsicGasTooLowError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /intrinsic gas too low/\n});\nexport class TransactionTypeNotSupportedError extends BaseError {\n constructor({ cause }) {\n super('The transaction type is not supported for this chain.', {\n cause,\n name: 'TransactionTypeNotSupportedError',\n });\n }\n}\nObject.defineProperty(TransactionTypeNotSupportedError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /transaction type not valid/\n});\nexport class TipAboveFeeCapError extends BaseError {\n constructor({ cause, maxPriorityFeePerGas, maxFeePerGas, } = {}) {\n super([\n `The provided tip (\\`maxPriorityFeePerGas\\`${maxPriorityFeePerGas\n ? ` = ${formatGwei(maxPriorityFeePerGas)} gwei`\n : ''}) cannot be higher than the fee cap (\\`maxFeePerGas\\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ''}).`,\n ].join('\\n'), {\n cause,\n name: 'TipAboveFeeCapError',\n });\n }\n}\nObject.defineProperty(TipAboveFeeCapError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/\n});\nexport class UnknownNodeError extends BaseError {\n constructor({ cause }) {\n super(`An error occurred while executing: ${cause?.shortMessage}`, {\n cause,\n name: 'UnknownNodeError',\n });\n }\n}\n//# sourceMappingURL=node.js.map","/**\n * Map with a LRU (Least recently used) policy.\n *\n * @link https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU\n */\nexport class LruMap extends Map {\n constructor(size) {\n super();\n Object.defineProperty(this, \"maxSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.maxSize = size;\n }\n get(key) {\n const value = super.get(key);\n if (super.has(key) && value !== undefined) {\n this.delete(key);\n super.set(key, value);\n }\n return value;\n }\n set(key, value) {\n super.set(key, value);\n if (this.maxSize && this.size > this.maxSize) {\n const firstKey = this.keys().next().value;\n if (firstKey)\n this.delete(firstKey);\n }\n return this;\n }\n}\n//# sourceMappingURL=lru.js.map","const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nfunction split(lst, le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nconst rotr32L = (h, _l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { fromBig, split, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, rotlSH, rotlSL, rotlBH, rotlBL, add, add3L, add3H, add4L, add4H, add5H, add5L, };\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexport default u64;\n//# sourceMappingURL=_u64.js.map","import { bytes, exists, number, output } from './_assert.js';\nimport { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.js';\nimport { Hash, u32, toBytes, wrapConstructor, wrapXOFConstructorWithOpts, isLE, byteSwap32, } from './utils.js';\n// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.\n// It's called a sponge function.\n// Various per round constants calculations\nconst SHA3_PI = [];\nconst SHA3_ROTL = [];\nconst _SHA3_IOTA = [];\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nconst _2n = /* @__PURE__ */ BigInt(2);\nconst _7n = /* @__PURE__ */ BigInt(7);\nconst _256n = /* @__PURE__ */ BigInt(256);\nconst _0x71n = /* @__PURE__ */ BigInt(0x71);\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n // Pi\n [x, y] = [y, (2 * x + 3 * y) % 5];\n SHA3_PI.push(2 * (5 * y + x));\n // Rotational\n SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n // Iota\n let t = _0n;\n for (let j = 0; j < 7; j++) {\n R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n if (R & _2n)\n t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);\n }\n _SHA3_IOTA.push(t);\n}\nconst [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);\n// Left rotation (without 0, 32, 64)\nconst rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));\nconst rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));\n// Same as keccakf1600, but allows to skip some rounds\nexport function keccakP(s, rounds = 24) {\n const B = new Uint32Array(5 * 2);\n // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n for (let round = 24 - rounds; round < 24; round++) {\n // Theta θ\n for (let x = 0; x < 10; x++)\n B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n for (let x = 0; x < 10; x += 2) {\n const idx1 = (x + 8) % 10;\n const idx0 = (x + 2) % 10;\n const B0 = B[idx0];\n const B1 = B[idx0 + 1];\n const Th = rotlH(B0, B1, 1) ^ B[idx1];\n const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n for (let y = 0; y < 50; y += 10) {\n s[x + y] ^= Th;\n s[x + y + 1] ^= Tl;\n }\n }\n // Rho (ρ) and Pi (π)\n let curH = s[2];\n let curL = s[3];\n for (let t = 0; t < 24; t++) {\n const shift = SHA3_ROTL[t];\n const Th = rotlH(curH, curL, shift);\n const Tl = rotlL(curH, curL, shift);\n const PI = SHA3_PI[t];\n curH = s[PI];\n curL = s[PI + 1];\n s[PI] = Th;\n s[PI + 1] = Tl;\n }\n // Chi (χ)\n for (let y = 0; y < 50; y += 10) {\n for (let x = 0; x < 10; x++)\n B[x] = s[y + x];\n for (let x = 0; x < 10; x++)\n s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n }\n // Iota (ι)\n s[0] ^= SHA3_IOTA_H[round];\n s[1] ^= SHA3_IOTA_L[round];\n }\n B.fill(0);\n}\nexport class Keccak extends Hash {\n // NOTE: we accept arguments in bytes instead of bits here.\n constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {\n super();\n this.blockLen = blockLen;\n this.suffix = suffix;\n this.outputLen = outputLen;\n this.enableXOF = enableXOF;\n this.rounds = rounds;\n this.pos = 0;\n this.posOut = 0;\n this.finished = false;\n this.destroyed = false;\n // Can be passed from user as dkLen\n number(outputLen);\n // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes\n if (0 >= this.blockLen || this.blockLen >= 200)\n throw new Error('Sha3 supports only keccak-f1600 function');\n this.state = new Uint8Array(200);\n this.state32 = u32(this.state);\n }\n keccak() {\n if (!isLE)\n byteSwap32(this.state32);\n keccakP(this.state32, this.rounds);\n if (!isLE)\n byteSwap32(this.state32);\n this.posOut = 0;\n this.pos = 0;\n }\n update(data) {\n exists(this);\n const { blockLen, state } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n for (let i = 0; i < take; i++)\n state[this.pos++] ^= data[pos++];\n if (this.pos === blockLen)\n this.keccak();\n }\n return this;\n }\n finish() {\n if (this.finished)\n return;\n this.finished = true;\n const { state, suffix, pos, blockLen } = this;\n // Do the padding\n state[pos] ^= suffix;\n if ((suffix & 0x80) !== 0 && pos === blockLen - 1)\n this.keccak();\n state[blockLen - 1] ^= 0x80;\n this.keccak();\n }\n writeInto(out) {\n exists(this, false);\n bytes(out);\n this.finish();\n const bufferOut = this.state;\n const { blockLen } = this;\n for (let pos = 0, len = out.length; pos < len;) {\n if (this.posOut >= blockLen)\n this.keccak();\n const take = Math.min(blockLen - this.posOut, len - pos);\n out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n this.posOut += take;\n pos += take;\n }\n return out;\n }\n xofInto(out) {\n // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF\n if (!this.enableXOF)\n throw new Error('XOF is not possible for this instance');\n return this.writeInto(out);\n }\n xof(bytes) {\n number(bytes);\n return this.xofInto(new Uint8Array(bytes));\n }\n digestInto(out) {\n output(out, this);\n if (this.finished)\n throw new Error('digest() was already called');\n this.writeInto(out);\n this.destroy();\n return out;\n }\n digest() {\n return this.digestInto(new Uint8Array(this.outputLen));\n }\n destroy() {\n this.destroyed = true;\n this.state.fill(0);\n }\n _cloneInto(to) {\n const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));\n to.state32.set(this.state32);\n to.pos = this.pos;\n to.posOut = this.posOut;\n to.finished = this.finished;\n to.rounds = rounds;\n // Suffix can change in cSHAKE\n to.suffix = suffix;\n to.outputLen = outputLen;\n to.enableXOF = enableXOF;\n to.destroyed = this.destroyed;\n return to;\n }\n}\nconst gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));\nexport const sha3_224 = /* @__PURE__ */ gen(0x06, 144, 224 / 8);\n/**\n * SHA3-256 hash function\n * @param message - that would be hashed\n */\nexport const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8);\nexport const sha3_384 = /* @__PURE__ */ gen(0x06, 104, 384 / 8);\nexport const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);\nexport const keccak_224 = /* @__PURE__ */ gen(0x01, 144, 224 / 8);\n/**\n * keccak-256 hash function. Different from SHA3-256.\n * @param message - that would be hashed\n */\nexport const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);\nexport const keccak_384 = /* @__PURE__ */ gen(0x01, 104, 384 / 8);\nexport const keccak_512 = /* @__PURE__ */ gen(0x01, 72, 512 / 8);\nconst genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));\nexport const shake128 = /* @__PURE__ */ genShake(0x1f, 168, 128 / 8);\nexport const shake256 = /* @__PURE__ */ genShake(0x1f, 136, 256 / 8);\n//# sourceMappingURL=sha3.js.map","import { keccak_256 } from '@noble/hashes/sha3';\nimport { isHex } from '../data/isHex.js';\nimport { toBytes } from '../encoding/toBytes.js';\nimport { toHex } from '../encoding/toHex.js';\nexport function keccak256(value, to_) {\n const to = to_ || 'hex';\n const bytes = keccak_256(isHex(value, { strict: false }) ? toBytes(value) : value);\n if (to === 'bytes')\n return bytes;\n return toHex(bytes);\n}\n//# sourceMappingURL=keccak256.js.map","import { InvalidAddressError } from '../../errors/address.js';\nimport { stringToBytes, } from '../encoding/toBytes.js';\nimport { keccak256 } from '../hash/keccak256.js';\nimport { LruMap } from '../lru.js';\nimport { isAddress } from './isAddress.js';\nconst checksumAddressCache = /*#__PURE__*/ new LruMap(8192);\nexport function checksumAddress(address_, \n/**\n * Warning: EIP-1191 checksum addresses are generally not backwards compatible with the\n * wider Ethereum ecosystem, meaning it will break when validated against an application/tool\n * that relies on EIP-55 checksum encoding (checksum without chainId).\n *\n * It is highly recommended to not use this feature unless you\n * know what you are doing.\n *\n * See more: https://github.com/ethereum/EIPs/issues/1121\n */\nchainId) {\n if (checksumAddressCache.has(`${address_}.${chainId}`))\n return checksumAddressCache.get(`${address_}.${chainId}`);\n const hexAddress = chainId\n ? `${chainId}${address_.toLowerCase()}`\n : address_.substring(2).toLowerCase();\n const hash = keccak256(stringToBytes(hexAddress), 'bytes');\n const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split('');\n for (let i = 0; i < 40; i += 2) {\n if (hash[i >> 1] >> 4 >= 8 && address[i]) {\n address[i] = address[i].toUpperCase();\n }\n if ((hash[i >> 1] & 0x0f) >= 8 && address[i + 1]) {\n address[i + 1] = address[i + 1].toUpperCase();\n }\n }\n const result = `0x${address.join('')}`;\n checksumAddressCache.set(`${address_}.${chainId}`, result);\n return result;\n}\nexport function getAddress(address, \n/**\n * Warning: EIP-1191 checksum addresses are generally not backwards compatible with the\n * wider Ethereum ecosystem, meaning it will break when validated against an application/tool\n * that relies on EIP-55 checksum encoding (checksum without chainId).\n *\n * It is highly recommended to not use this feature unless you\n * know what you are doing.\n *\n * See more: https://github.com/ethereum/EIPs/issues/1121\n */\nchainId) {\n if (!isAddress(address, { strict: false }))\n throw new InvalidAddressError({ address });\n return checksumAddress(address, chainId);\n}\n//# sourceMappingURL=getAddress.js.map","import { LruMap } from '../lru.js';\nimport { checksumAddress } from './getAddress.js';\nconst addressRegex = /^0x[a-fA-F0-9]{40}$/;\n/** @internal */\nexport const isAddressCache = /*#__PURE__*/ new LruMap(8192);\nexport function isAddress(address, options) {\n const { strict = true } = options ?? {};\n const cacheKey = `${address}.${strict}`;\n if (isAddressCache.has(cacheKey))\n return isAddressCache.get(cacheKey);\n const result = (() => {\n if (!addressRegex.test(address))\n return false;\n if (address.toLowerCase() === address)\n return true;\n if (strict)\n return checksumAddress(address) === address;\n return true;\n })();\n isAddressCache.set(cacheKey, result);\n return result;\n}\n//# sourceMappingURL=isAddress.js.map","import { SliceOffsetOutOfBoundsError, } from '../../errors/data.js';\nimport { isHex } from './isHex.js';\nimport { size } from './size.js';\n/**\n * @description Returns a section of the hex or byte array given a start/end bytes offset.\n *\n * @param value The hex or byte array to slice.\n * @param start The start offset (in bytes).\n * @param end The end offset (in bytes).\n */\nexport function slice(value, start, end, { strict } = {}) {\n if (isHex(value, { strict: false }))\n return sliceHex(value, start, end, {\n strict,\n });\n return sliceBytes(value, start, end, {\n strict,\n });\n}\nfunction assertStartOffset(value, start) {\n if (typeof start === 'number' && start > 0 && start > size(value) - 1)\n throw new SliceOffsetOutOfBoundsError({\n offset: start,\n position: 'start',\n size: size(value),\n });\n}\nfunction assertEndOffset(value, start, end) {\n if (typeof start === 'number' &&\n typeof end === 'number' &&\n size(value) !== end - start) {\n throw new SliceOffsetOutOfBoundsError({\n offset: end,\n position: 'end',\n size: size(value),\n });\n }\n}\n/**\n * @description Returns a section of the byte array given a start/end bytes offset.\n *\n * @param value The byte array to slice.\n * @param start The start offset (in bytes).\n * @param end The end offset (in bytes).\n */\nexport function sliceBytes(value_, start, end, { strict } = {}) {\n assertStartOffset(value_, start);\n const value = value_.slice(start, end);\n if (strict)\n assertEndOffset(value, start, end);\n return value;\n}\n/**\n * @description Returns a section of the hex value given a start/end bytes offset.\n *\n * @param value The hex value to slice.\n * @param start The start offset (in bytes).\n * @param end The end offset (in bytes).\n */\nexport function sliceHex(value_, start, end, { strict } = {}) {\n assertStartOffset(value_, start);\n const value = `0x${value_\n .replace('0x', '')\n .slice((start ?? 0) * 2, (end ?? value_.length) * 2)}`;\n if (strict)\n assertEndOffset(value, start, end);\n return value;\n}\n//# sourceMappingURL=slice.js.map","import { InvalidSerializableTransactionError, } from '../../errors/transaction.js';\nexport function getTransactionType(transaction) {\n if (transaction.type)\n return transaction.type;\n if (typeof transaction.authorizationList !== 'undefined')\n return 'eip7702';\n if (typeof transaction.blobs !== 'undefined' ||\n typeof transaction.blobVersionedHashes !== 'undefined' ||\n typeof transaction.maxFeePerBlobGas !== 'undefined' ||\n typeof transaction.sidecars !== 'undefined')\n return 'eip4844';\n if (typeof transaction.maxFeePerGas !== 'undefined' ||\n typeof transaction.maxPriorityFeePerGas !== 'undefined') {\n return 'eip1559';\n }\n if (typeof transaction.gasPrice !== 'undefined') {\n if (typeof transaction.accessList !== 'undefined')\n return 'eip2930';\n return 'legacy';\n }\n throw new InvalidSerializableTransactionError({ transaction });\n}\n//# sourceMappingURL=getTransactionType.js.map","import { ChainMismatchError, ChainNotFoundError, } from '../../errors/chain.js';\nexport function assertCurrentChain({ chain, currentChainId, }) {\n if (!chain)\n throw new ChainNotFoundError();\n if (currentChainId !== chain.id)\n throw new ChainMismatchError({ chain, currentChainId });\n}\n//# sourceMappingURL=assertCurrentChain.js.map","import { ChainDoesNotSupportContract, } from '../../errors/chain.js';\nexport function getChainContractAddress({ blockNumber, chain, contract: name, }) {\n const contract = chain?.contracts?.[name];\n if (!contract)\n throw new ChainDoesNotSupportContract({\n chain,\n contract: { name },\n });\n if (blockNumber &&\n contract.blockCreated &&\n contract.blockCreated > blockNumber)\n throw new ChainDoesNotSupportContract({\n blockNumber,\n chain,\n contract: {\n name,\n blockCreated: contract.blockCreated,\n },\n });\n return contract.address;\n}\n//# sourceMappingURL=getChainContractAddress.js.map","export function parseAccount(account) {\n if (typeof account === 'string')\n return { address: account, type: 'json-rpc' };\n return account;\n}\n//# sourceMappingURL=parseAccount.js.map","import { formatGwei } from '../utils/unit/formatGwei.js';\nimport { BaseError } from './base.js';\nexport class BaseFeeScalarError extends BaseError {\n constructor() {\n super('`baseFeeMultiplier` must be greater than 1.', {\n name: 'BaseFeeScalarError',\n });\n }\n}\nexport class Eip1559FeesNotSupportedError extends BaseError {\n constructor() {\n super('Chain does not support EIP-1559 fees.', {\n name: 'Eip1559FeesNotSupportedError',\n });\n }\n}\nexport class MaxFeePerGasTooLowError extends BaseError {\n constructor({ maxPriorityFeePerGas }) {\n super(`\\`maxFeePerGas\\` cannot be less than the \\`maxPriorityFeePerGas\\` (${formatGwei(maxPriorityFeePerGas)} gwei).`, { name: 'MaxFeePerGasTooLowError' });\n }\n}\n//# sourceMappingURL=fee.js.map","/**\n * Retrieves and returns an action from the client (if exists), and falls\n * back to the tree-shakable action.\n *\n * Useful for extracting overridden actions from a client (ie. if a consumer\n * wants to override the `sendTransaction` implementation).\n */\nexport function getAction(client, actionFn, \n// Some minifiers drop `Function.prototype.name`, or replace it with short letters,\n// meaning that `actionFn.name` will not always work. For that case, the consumer\n// needs to pass the name explicitly.\nname) {\n const action_implicit = client[actionFn.name];\n if (typeof action_implicit === 'function')\n return action_implicit;\n const action_explicit = client[name];\n if (typeof action_explicit === 'function')\n return action_explicit;\n return (params) => actionFn(client, params);\n}\n//# sourceMappingURL=getAction.js.map","import { BaseError } from './base.js';\nexport class BlockNotFoundError extends BaseError {\n constructor({ blockHash, blockNumber, }) {\n let identifier = 'Block';\n if (blockHash)\n identifier = `Block at hash \"${blockHash}\"`;\n if (blockNumber)\n identifier = `Block at number \"${blockNumber}\"`;\n super(`${identifier} could not be found.`, { name: 'BlockNotFoundError' });\n }\n}\n//# sourceMappingURL=block.js.map","import { BlockNotFoundError, } from '../../errors/block.js';\nimport { numberToHex, } from '../../utils/encoding/toHex.js';\nimport { formatBlock, } from '../../utils/formatters/block.js';\n/**\n * Returns information about a block at a block number, hash, or tag.\n *\n * - Docs: https://viem.sh/docs/actions/public/getBlock\n * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/fetching-blocks\n * - JSON-RPC Methods:\n * - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) for `blockNumber` & `blockTag`.\n * - Calls [`eth_getBlockByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbyhash) for `blockHash`.\n *\n * @param client - Client to use\n * @param parameters - {@link GetBlockParameters}\n * @returns Information about the block. {@link GetBlockReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { getBlock } from 'viem/public'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const block = await getBlock(client)\n */\nexport async function getBlock(client, { blockHash, blockNumber, blockTag: blockTag_, includeTransactions: includeTransactions_, } = {}) {\n const blockTag = blockTag_ ?? 'latest';\n const includeTransactions = includeTransactions_ ?? false;\n const blockNumberHex = blockNumber !== undefined ? numberToHex(blockNumber) : undefined;\n let block = null;\n if (blockHash) {\n block = await client.request({\n method: 'eth_getBlockByHash',\n params: [blockHash, includeTransactions],\n }, { dedupe: true });\n }\n else {\n block = await client.request({\n method: 'eth_getBlockByNumber',\n params: [blockNumberHex || blockTag, includeTransactions],\n }, { dedupe: Boolean(blockNumberHex) });\n }\n if (!block)\n throw new BlockNotFoundError({ blockHash, blockNumber });\n const format = client.chain?.formatters?.block?.format || formatBlock;\n return format(block);\n}\n//# sourceMappingURL=getBlock.js.map","/**\n * Returns the current price of gas (in wei).\n *\n * - Docs: https://viem.sh/docs/actions/public/getGasPrice\n * - JSON-RPC Methods: [`eth_gasPrice`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gasprice)\n *\n * @param client - Client to use\n * @returns The gas price (in wei). {@link GetGasPriceReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { getGasPrice } from 'viem/public'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const gasPrice = await getGasPrice(client)\n */\nexport async function getGasPrice(client) {\n const gasPrice = await client.request({\n method: 'eth_gasPrice',\n });\n return BigInt(gasPrice);\n}\n//# sourceMappingURL=getGasPrice.js.map","import { Eip1559FeesNotSupportedError, } from '../../errors/fee.js';\nimport { hexToBigInt, } from '../../utils/encoding/fromHex.js';\nimport { getAction } from '../../utils/getAction.js';\nimport { getBlock } from './getBlock.js';\nimport { getGasPrice } from './getGasPrice.js';\n/**\n * Returns an estimate for the max priority fee per gas (in wei) for a\n * transaction to be likely included in the next block.\n * Defaults to [`chain.fees.defaultPriorityFee`](/docs/clients/chains#fees-defaultpriorityfee) if set.\n *\n * - Docs: https://viem.sh/docs/actions/public/estimateMaxPriorityFeePerGas\n *\n * @param client - Client to use\n * @returns An estimate (in wei) for the max priority fee per gas. {@link EstimateMaxPriorityFeePerGasReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { estimateMaxPriorityFeePerGas } from 'viem/actions'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const maxPriorityFeePerGas = await estimateMaxPriorityFeePerGas(client)\n * // 10000000n\n */\nexport async function estimateMaxPriorityFeePerGas(client, args) {\n return internal_estimateMaxPriorityFeePerGas(client, args);\n}\nexport async function internal_estimateMaxPriorityFeePerGas(client, args) {\n const { block: block_, chain = client.chain, request } = args || {};\n try {\n const maxPriorityFeePerGas = chain?.fees?.maxPriorityFeePerGas ?? chain?.fees?.defaultPriorityFee;\n if (typeof maxPriorityFeePerGas === 'function') {\n const block = block_ || (await getAction(client, getBlock, 'getBlock')({}));\n const maxPriorityFeePerGas_ = await maxPriorityFeePerGas({\n block,\n client,\n request,\n });\n if (maxPriorityFeePerGas_ === null)\n throw new Error();\n return maxPriorityFeePerGas_;\n }\n if (typeof maxPriorityFeePerGas !== 'undefined')\n return maxPriorityFeePerGas;\n const maxPriorityFeePerGasHex = await client.request({\n method: 'eth_maxPriorityFeePerGas',\n });\n return hexToBigInt(maxPriorityFeePerGasHex);\n }\n catch {\n // If the RPC Provider does not support `eth_maxPriorityFeePerGas`\n // fall back to calculating it manually via `gasPrice - baseFeePerGas`.\n // See: https://github.com/ethereum/pm/issues/328#:~:text=eth_maxPriorityFeePerGas%20after%20London%20will%20effectively%20return%20eth_gasPrice%20%2D%20baseFee\n const [block, gasPrice] = await Promise.all([\n block_\n ? Promise.resolve(block_)\n : getAction(client, getBlock, 'getBlock')({}),\n getAction(client, getGasPrice, 'getGasPrice')({}),\n ]);\n if (typeof block.baseFeePerGas !== 'bigint')\n throw new Eip1559FeesNotSupportedError();\n const maxPriorityFeePerGas = gasPrice - block.baseFeePerGas;\n if (maxPriorityFeePerGas < 0n)\n return 0n;\n return maxPriorityFeePerGas;\n }\n}\n//# sourceMappingURL=estimateMaxPriorityFeePerGas.js.map","import { BaseFeeScalarError, Eip1559FeesNotSupportedError, } from '../../errors/fee.js';\nimport { getAction } from '../../utils/getAction.js';\nimport { internal_estimateMaxPriorityFeePerGas, } from './estimateMaxPriorityFeePerGas.js';\nimport { getBlock } from './getBlock.js';\nimport { getGasPrice } from './getGasPrice.js';\n/**\n * Returns an estimate for the fees per gas (in wei) for a\n * transaction to be likely included in the next block.\n * Defaults to [`chain.fees.estimateFeesPerGas`](/docs/clients/chains#fees-estimatefeespergas) if set.\n *\n * - Docs: https://viem.sh/docs/actions/public/estimateFeesPerGas\n *\n * @param client - Client to use\n * @param parameters - {@link EstimateFeesPerGasParameters}\n * @returns An estimate (in wei) for the fees per gas. {@link EstimateFeesPerGasReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { estimateFeesPerGas } from 'viem/actions'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const maxPriorityFeePerGas = await estimateFeesPerGas(client)\n * // { maxFeePerGas: ..., maxPriorityFeePerGas: ... }\n */\nexport async function estimateFeesPerGas(client, args) {\n return internal_estimateFeesPerGas(client, args);\n}\nexport async function internal_estimateFeesPerGas(client, args) {\n const { block: block_, chain = client.chain, request, type = 'eip1559', } = args || {};\n const baseFeeMultiplier = await (async () => {\n if (typeof chain?.fees?.baseFeeMultiplier === 'function')\n return chain.fees.baseFeeMultiplier({\n block: block_,\n client,\n request,\n });\n return chain?.fees?.baseFeeMultiplier ?? 1.2;\n })();\n if (baseFeeMultiplier < 1)\n throw new BaseFeeScalarError();\n const decimals = baseFeeMultiplier.toString().split('.')[1]?.length ?? 0;\n const denominator = 10 ** decimals;\n const multiply = (base) => (base * BigInt(Math.ceil(baseFeeMultiplier * denominator))) /\n BigInt(denominator);\n const block = block_\n ? block_\n : await getAction(client, getBlock, 'getBlock')({});\n if (typeof chain?.fees?.estimateFeesPerGas === 'function') {\n const fees = (await chain.fees.estimateFeesPerGas({\n block: block_,\n client,\n multiply,\n request,\n type,\n }));\n if (fees !== null)\n return fees;\n }\n if (type === 'eip1559') {\n if (typeof block.baseFeePerGas !== 'bigint')\n throw new Eip1559FeesNotSupportedError();\n const maxPriorityFeePerGas = typeof request?.maxPriorityFeePerGas === 'bigint'\n ? request.maxPriorityFeePerGas\n : await internal_estimateMaxPriorityFeePerGas(client, {\n block: block,\n chain,\n request,\n });\n const baseFeePerGas = multiply(block.baseFeePerGas);\n const maxFeePerGas = request?.maxFeePerGas ?? baseFeePerGas + maxPriorityFeePerGas;\n return {\n maxFeePerGas,\n maxPriorityFeePerGas,\n };\n }\n const gasPrice = request?.gasPrice ??\n multiply(await getAction(client, getGasPrice, 'getGasPrice')({}));\n return {\n gasPrice,\n };\n}\n//# sourceMappingURL=estimateFeesPerGas.js.map","import { checksumAddress, } from '../../utils/address/getAddress.js';\nimport { keccak256, } from '../../utils/hash/keccak256.js';\n/**\n * @description Converts an ECDSA public key to an address.\n *\n * @param publicKey The public key to convert.\n *\n * @returns The address.\n */\nexport function publicKeyToAddress(publicKey) {\n const address = keccak256(`0x${publicKey.substring(4)}`).substring(26);\n return checksumAddress(`0x${address}`);\n}\n//# sourceMappingURL=publicKeyToAddress.js.map","import { isHex } from '../data/isHex.js';\nimport { hexToBigInt, hexToNumber, } from '../encoding/fromHex.js';\nimport { toHex } from '../encoding/toHex.js';\nexport async function recoverPublicKey({ hash, signature, }) {\n const hashHex = isHex(hash) ? hash : toHex(hash);\n const { secp256k1 } = await import('@noble/curves/secp256k1');\n const signature_ = (() => {\n // typeof signature: `Signature`\n if (typeof signature === 'object' && 'r' in signature && 's' in signature) {\n const { r, s, v, yParity } = signature;\n const yParityOrV = Number(yParity ?? v);\n const recoveryBit = toRecoveryBit(yParityOrV);\n return new secp256k1.Signature(hexToBigInt(r), hexToBigInt(s)).addRecoveryBit(recoveryBit);\n }\n // typeof signature: `Hex | ByteArray`\n const signatureHex = isHex(signature) ? signature : toHex(signature);\n const yParityOrV = hexToNumber(`0x${signatureHex.slice(130)}`);\n const recoveryBit = toRecoveryBit(yParityOrV);\n return secp256k1.Signature.fromCompact(signatureHex.substring(2, 130)).addRecoveryBit(recoveryBit);\n })();\n const publicKey = signature_\n .recoverPublicKey(hashHex.substring(2))\n .toHex(false);\n return `0x${publicKey}`;\n}\nfunction toRecoveryBit(yParityOrV) {\n if (yParityOrV === 0 || yParityOrV === 1)\n return yParityOrV;\n if (yParityOrV === 27)\n return 0;\n if (yParityOrV === 28)\n return 1;\n throw new Error('Invalid yParityOrV value');\n}\n//# sourceMappingURL=recoverPublicKey.js.map","import { publicKeyToAddress } from '../../accounts/utils/publicKeyToAddress.js';\nimport { recoverPublicKey } from './recoverPublicKey.js';\nexport async function recoverAddress({ hash, signature, }) {\n return publicKeyToAddress(await recoverPublicKey({ hash: hash, signature }));\n}\n//# sourceMappingURL=recoverAddress.js.map","import { concatHex, } from '../../../utils/data/concat.js';\nimport { hexToBytes, } from '../../../utils/encoding/toBytes.js';\nimport { numberToHex, } from '../../../utils/encoding/toHex.js';\nimport { toRlp } from '../../../utils/encoding/toRlp.js';\nimport { keccak256, } from '../../../utils/hash/keccak256.js';\n/**\n * Computes an Authorization hash in [EIP-7702 format](https://eips.ethereum.org/EIPS/eip-7702): `keccak256('0x05' || rlp([chain_id, address, nonce]))`.\n */\nexport function hashAuthorization(parameters) {\n const { chainId, contractAddress, nonce, to } = parameters;\n const hash = keccak256(concatHex([\n '0x05',\n toRlp([\n chainId ? numberToHex(chainId) : '0x',\n contractAddress,\n nonce ? numberToHex(nonce) : '0x',\n ]),\n ]));\n if (to === 'bytes')\n return hexToBytes(hash);\n return hash;\n}\n//# sourceMappingURL=hashAuthorization.js.map","import { recoverAddress, } from '../../../utils/signature/recoverAddress.js';\nimport { hashAuthorization, } from './hashAuthorization.js';\nexport async function recoverAuthorizationAddress(parameters) {\n const { authorization, signature } = parameters;\n return recoverAddress({\n hash: hashAuthorization(authorization),\n signature: (signature ?? authorization),\n });\n}\n//# sourceMappingURL=recoverAuthorizationAddress.js.map","import { formatEther } from '../utils/unit/formatEther.js';\nimport { formatGwei } from '../utils/unit/formatGwei.js';\nimport { BaseError } from './base.js';\nimport { prettyPrint } from './transaction.js';\nexport class EstimateGasExecutionError extends BaseError {\n constructor(cause, { account, docsPath, chain, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, }) {\n const prettyArgs = prettyPrint({\n from: account?.address,\n to,\n value: typeof value !== 'undefined' &&\n `${formatEther(value)} ${chain?.nativeCurrency?.symbol || 'ETH'}`,\n data,\n gas,\n gasPrice: typeof gasPrice !== 'undefined' && `${formatGwei(gasPrice)} gwei`,\n maxFeePerGas: typeof maxFeePerGas !== 'undefined' &&\n `${formatGwei(maxFeePerGas)} gwei`,\n maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== 'undefined' &&\n `${formatGwei(maxPriorityFeePerGas)} gwei`,\n nonce,\n });\n super(cause.shortMessage, {\n cause,\n docsPath,\n metaMessages: [\n ...(cause.metaMessages ? [...cause.metaMessages, ' '] : []),\n 'Estimate Gas Arguments:',\n prettyArgs,\n ].filter(Boolean),\n name: 'EstimateGasExecutionError',\n });\n Object.defineProperty(this, \"cause\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.cause = cause;\n }\n}\n//# sourceMappingURL=estimateGas.js.map","export const stringify = (value, replacer, space) => JSON.stringify(value, (key, value_) => {\n const value = typeof value_ === 'bigint' ? value_.toString() : value_;\n return typeof replacer === 'function' ? replacer(key, value) : value;\n}, space);\n//# sourceMappingURL=stringify.js.map","export const getContractAddress = (address) => address;\nexport const getUrl = (url) => url;\n//# sourceMappingURL=utils.js.map","import { stringify } from '../utils/stringify.js';\nimport { BaseError } from './base.js';\nimport { getUrl } from './utils.js';\nexport class HttpRequestError extends BaseError {\n constructor({ body, cause, details, headers, status, url, }) {\n super('HTTP request failed.', {\n cause,\n details,\n metaMessages: [\n status && `Status: ${status}`,\n `URL: ${getUrl(url)}`,\n body && `Request body: ${stringify(body)}`,\n ].filter(Boolean),\n name: 'HttpRequestError',\n });\n Object.defineProperty(this, \"body\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"headers\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"status\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"url\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.body = body;\n this.headers = headers;\n this.status = status;\n this.url = url;\n }\n}\nexport class WebSocketRequestError extends BaseError {\n constructor({ body, cause, details, url, }) {\n super('WebSocket request failed.', {\n cause,\n details,\n metaMessages: [\n `URL: ${getUrl(url)}`,\n body && `Request body: ${stringify(body)}`,\n ].filter(Boolean),\n name: 'WebSocketRequestError',\n });\n }\n}\nexport class RpcRequestError extends BaseError {\n constructor({ body, error, url, }) {\n super('RPC Request failed.', {\n cause: error,\n details: error.message,\n metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`],\n name: 'RpcRequestError',\n });\n Object.defineProperty(this, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.code = error.code;\n }\n}\nexport class SocketClosedError extends BaseError {\n constructor({ url, } = {}) {\n super('The socket has been closed.', {\n metaMessages: [url && `URL: ${getUrl(url)}`].filter(Boolean),\n name: 'SocketClosedError',\n });\n }\n}\nexport class TimeoutError extends BaseError {\n constructor({ body, url, }) {\n super('The request took too long to respond.', {\n details: 'The request timed out.',\n metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`],\n name: 'TimeoutError',\n });\n }\n}\n//# sourceMappingURL=request.js.map","import { BaseError } from './base.js';\nimport { RpcRequestError } from './request.js';\nconst unknownErrorCode = -1;\nexport class RpcError extends BaseError {\n constructor(cause, { code, docsPath, metaMessages, name, shortMessage, }) {\n super(shortMessage, {\n cause,\n docsPath,\n metaMessages: metaMessages || cause?.metaMessages,\n name: name || 'RpcError',\n });\n Object.defineProperty(this, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.name = name || cause.name;\n this.code = (cause instanceof RpcRequestError ? cause.code : (code ?? unknownErrorCode));\n }\n}\nexport class ProviderRpcError extends RpcError {\n constructor(cause, options) {\n super(cause, options);\n Object.defineProperty(this, \"data\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.data = options.data;\n }\n}\nexport class ParseRpcError extends RpcError {\n constructor(cause) {\n super(cause, {\n code: ParseRpcError.code,\n name: 'ParseRpcError',\n shortMessage: 'Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.',\n });\n }\n}\nObject.defineProperty(ParseRpcError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: -32700\n});\nexport class InvalidRequestRpcError extends RpcError {\n constructor(cause) {\n super(cause, {\n code: InvalidRequestRpcError.code,\n name: 'InvalidRequestRpcError',\n shortMessage: 'JSON is not a valid request object.',\n });\n }\n}\nObject.defineProperty(InvalidRequestRpcError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: -32600\n});\nexport class MethodNotFoundRpcError extends RpcError {\n constructor(cause, { method } = {}) {\n super(cause, {\n code: MethodNotFoundRpcError.code,\n name: 'MethodNotFoundRpcError',\n shortMessage: `The method${method ? ` \"${method}\"` : ''} does not exist / is not available.`,\n });\n }\n}\nObject.defineProperty(MethodNotFoundRpcError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: -32601\n});\nexport class InvalidParamsRpcError extends RpcError {\n constructor(cause) {\n super(cause, {\n code: InvalidParamsRpcError.code,\n name: 'InvalidParamsRpcError',\n shortMessage: [\n 'Invalid parameters were provided to the RPC method.',\n 'Double check you have provided the correct parameters.',\n ].join('\\n'),\n });\n }\n}\nObject.defineProperty(InvalidParamsRpcError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: -32602\n});\nexport class InternalRpcError extends RpcError {\n constructor(cause) {\n super(cause, {\n code: InternalRpcError.code,\n name: 'InternalRpcError',\n shortMessage: 'An internal error was received.',\n });\n }\n}\nObject.defineProperty(InternalRpcError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: -32603\n});\nexport class InvalidInputRpcError extends RpcError {\n constructor(cause) {\n super(cause, {\n code: InvalidInputRpcError.code,\n name: 'InvalidInputRpcError',\n shortMessage: [\n 'Missing or invalid parameters.',\n 'Double check you have provided the correct parameters.',\n ].join('\\n'),\n });\n }\n}\nObject.defineProperty(InvalidInputRpcError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: -32000\n});\nexport class ResourceNotFoundRpcError extends RpcError {\n constructor(cause) {\n super(cause, {\n code: ResourceNotFoundRpcError.code,\n name: 'ResourceNotFoundRpcError',\n shortMessage: 'Requested resource not found.',\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'ResourceNotFoundRpcError'\n });\n }\n}\nObject.defineProperty(ResourceNotFoundRpcError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: -32001\n});\nexport class ResourceUnavailableRpcError extends RpcError {\n constructor(cause) {\n super(cause, {\n code: ResourceUnavailableRpcError.code,\n name: 'ResourceUnavailableRpcError',\n shortMessage: 'Requested resource not available.',\n });\n }\n}\nObject.defineProperty(ResourceUnavailableRpcError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: -32002\n});\nexport class TransactionRejectedRpcError extends RpcError {\n constructor(cause) {\n super(cause, {\n code: TransactionRejectedRpcError.code,\n name: 'TransactionRejectedRpcError',\n shortMessage: 'Transaction creation failed.',\n });\n }\n}\nObject.defineProperty(TransactionRejectedRpcError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: -32003\n});\nexport class MethodNotSupportedRpcError extends RpcError {\n constructor(cause, { method } = {}) {\n super(cause, {\n code: MethodNotSupportedRpcError.code,\n name: 'MethodNotSupportedRpcError',\n shortMessage: `Method${method ? ` \"${method}\"` : ''} is not implemented.`,\n });\n }\n}\nObject.defineProperty(MethodNotSupportedRpcError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: -32004\n});\nexport class LimitExceededRpcError extends RpcError {\n constructor(cause) {\n super(cause, {\n code: LimitExceededRpcError.code,\n name: 'LimitExceededRpcError',\n shortMessage: 'Request exceeds defined limit.',\n });\n }\n}\nObject.defineProperty(LimitExceededRpcError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: -32005\n});\nexport class JsonRpcVersionUnsupportedError extends RpcError {\n constructor(cause) {\n super(cause, {\n code: JsonRpcVersionUnsupportedError.code,\n name: 'JsonRpcVersionUnsupportedError',\n shortMessage: 'Version of JSON-RPC protocol is not supported.',\n });\n }\n}\nObject.defineProperty(JsonRpcVersionUnsupportedError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: -32006\n});\nexport class UserRejectedRequestError extends ProviderRpcError {\n constructor(cause) {\n super(cause, {\n code: UserRejectedRequestError.code,\n name: 'UserRejectedRequestError',\n shortMessage: 'User rejected the request.',\n });\n }\n}\nObject.defineProperty(UserRejectedRequestError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 4001\n});\nexport class UnauthorizedProviderError extends ProviderRpcError {\n constructor(cause) {\n super(cause, {\n code: UnauthorizedProviderError.code,\n name: 'UnauthorizedProviderError',\n shortMessage: 'The requested method and/or account has not been authorized by the user.',\n });\n }\n}\nObject.defineProperty(UnauthorizedProviderError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 4100\n});\nexport class UnsupportedProviderMethodError extends ProviderRpcError {\n constructor(cause, { method } = {}) {\n super(cause, {\n code: UnsupportedProviderMethodError.code,\n name: 'UnsupportedProviderMethodError',\n shortMessage: `The Provider does not support the requested method${method ? ` \" ${method}\"` : ''}.`,\n });\n }\n}\nObject.defineProperty(UnsupportedProviderMethodError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 4200\n});\nexport class ProviderDisconnectedError extends ProviderRpcError {\n constructor(cause) {\n super(cause, {\n code: ProviderDisconnectedError.code,\n name: 'ProviderDisconnectedError',\n shortMessage: 'The Provider is disconnected from all chains.',\n });\n }\n}\nObject.defineProperty(ProviderDisconnectedError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 4900\n});\nexport class ChainDisconnectedError extends ProviderRpcError {\n constructor(cause) {\n super(cause, {\n code: ChainDisconnectedError.code,\n name: 'ChainDisconnectedError',\n shortMessage: 'The Provider is not connected to the requested chain.',\n });\n }\n}\nObject.defineProperty(ChainDisconnectedError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 4901\n});\nexport class SwitchChainError extends ProviderRpcError {\n constructor(cause) {\n super(cause, {\n code: SwitchChainError.code,\n name: 'SwitchChainError',\n shortMessage: 'An error occurred when attempting to switch chain.',\n });\n }\n}\nObject.defineProperty(SwitchChainError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 4902\n});\nexport class UnknownRpcError extends RpcError {\n constructor(cause) {\n super(cause, {\n name: 'UnknownRpcError',\n shortMessage: 'An unknown RPC error occurred.',\n });\n }\n}\n//# sourceMappingURL=rpc.js.map","import { BaseError } from '../../errors/base.js';\nimport { ExecutionRevertedError, FeeCapTooHighError, FeeCapTooLowError, InsufficientFundsError, IntrinsicGasTooHighError, IntrinsicGasTooLowError, NonceMaxValueError, NonceTooHighError, NonceTooLowError, TipAboveFeeCapError, TransactionTypeNotSupportedError, UnknownNodeError, } from '../../errors/node.js';\nimport { RpcRequestError } from '../../errors/request.js';\nimport { InvalidInputRpcError, TransactionRejectedRpcError, } from '../../errors/rpc.js';\nexport function containsNodeError(err) {\n return (err instanceof TransactionRejectedRpcError ||\n err instanceof InvalidInputRpcError ||\n (err instanceof RpcRequestError && err.code === ExecutionRevertedError.code));\n}\nexport function getNodeError(err, args) {\n const message = (err.details || '').toLowerCase();\n const executionRevertedError = err instanceof BaseError\n ? err.walk((e) => e?.code ===\n ExecutionRevertedError.code)\n : err;\n if (executionRevertedError instanceof BaseError)\n return new ExecutionRevertedError({\n cause: err,\n message: executionRevertedError.details,\n });\n if (ExecutionRevertedError.nodeMessage.test(message))\n return new ExecutionRevertedError({\n cause: err,\n message: err.details,\n });\n if (FeeCapTooHighError.nodeMessage.test(message))\n return new FeeCapTooHighError({\n cause: err,\n maxFeePerGas: args?.maxFeePerGas,\n });\n if (FeeCapTooLowError.nodeMessage.test(message))\n return new FeeCapTooLowError({\n cause: err,\n maxFeePerGas: args?.maxFeePerGas,\n });\n if (NonceTooHighError.nodeMessage.test(message))\n return new NonceTooHighError({ cause: err, nonce: args?.nonce });\n if (NonceTooLowError.nodeMessage.test(message))\n return new NonceTooLowError({ cause: err, nonce: args?.nonce });\n if (NonceMaxValueError.nodeMessage.test(message))\n return new NonceMaxValueError({ cause: err, nonce: args?.nonce });\n if (InsufficientFundsError.nodeMessage.test(message))\n return new InsufficientFundsError({ cause: err });\n if (IntrinsicGasTooHighError.nodeMessage.test(message))\n return new IntrinsicGasTooHighError({ cause: err, gas: args?.gas });\n if (IntrinsicGasTooLowError.nodeMessage.test(message))\n return new IntrinsicGasTooLowError({ cause: err, gas: args?.gas });\n if (TransactionTypeNotSupportedError.nodeMessage.test(message))\n return new TransactionTypeNotSupportedError({ cause: err });\n if (TipAboveFeeCapError.nodeMessage.test(message))\n return new TipAboveFeeCapError({\n cause: err,\n maxFeePerGas: args?.maxFeePerGas,\n maxPriorityFeePerGas: args?.maxPriorityFeePerGas,\n });\n return new UnknownNodeError({\n cause: err,\n });\n}\n//# sourceMappingURL=getNodeError.js.map","import { EstimateGasExecutionError, } from '../../errors/estimateGas.js';\nimport { UnknownNodeError } from '../../errors/node.js';\nimport { getNodeError, } from './getNodeError.js';\nexport function getEstimateGasError(err, { docsPath, ...args }) {\n const cause = (() => {\n const cause = getNodeError(err, args);\n if (cause instanceof UnknownNodeError)\n return err;\n return cause;\n })();\n return new EstimateGasExecutionError(cause, {\n docsPath,\n ...args,\n });\n}\n//# sourceMappingURL=getEstimateGasError.js.map","/**\n * @description Picks out the keys from `value` that exist in the formatter..\n */\nexport function extract(value_, { format }) {\n if (!format)\n return {};\n const value = {};\n function extract_(formatted) {\n const keys = Object.keys(formatted);\n for (const key of keys) {\n if (key in value_)\n value[key] = value_[key];\n if (formatted[key] &&\n typeof formatted[key] === 'object' &&\n !Array.isArray(formatted[key]))\n extract_(formatted[key]);\n }\n }\n const formatted = format(value_ || {});\n extract_(formatted);\n return value;\n}\n//# sourceMappingURL=extract.js.map","import { BaseError } from './base.js';\nexport class AccountStateConflictError extends BaseError {\n constructor({ address }) {\n super(`State for account \"${address}\" is set multiple times.`, {\n name: 'AccountStateConflictError',\n });\n }\n}\nexport class StateAssignmentConflictError extends BaseError {\n constructor() {\n super('state and stateDiff are set on the same account.', {\n name: 'StateAssignmentConflictError',\n });\n }\n}\n/** @internal */\nexport function prettyStateMapping(stateMapping) {\n return stateMapping.reduce((pretty, { slot, value }) => {\n return `${pretty} ${slot}: ${value}\\n`;\n }, '');\n}\nexport function prettyStateOverride(stateOverride) {\n return stateOverride\n .reduce((pretty, { address, ...state }) => {\n let val = `${pretty} ${address}:\\n`;\n if (state.nonce)\n val += ` nonce: ${state.nonce}\\n`;\n if (state.balance)\n val += ` balance: ${state.balance}\\n`;\n if (state.code)\n val += ` code: ${state.code}\\n`;\n if (state.state) {\n val += ' state:\\n';\n val += prettyStateMapping(state.state);\n }\n if (state.stateDiff) {\n val += ' stateDiff:\\n';\n val += prettyStateMapping(state.stateDiff);\n }\n return val;\n }, ' State Override:\\n')\n .slice(0, -1);\n}\n//# sourceMappingURL=stateOverride.js.map","import { InvalidAddressError, } from '../errors/address.js';\nimport { InvalidBytesLengthError, } from '../errors/data.js';\nimport { AccountStateConflictError, StateAssignmentConflictError, } from '../errors/stateOverride.js';\nimport { isAddress } from './address/isAddress.js';\nimport { numberToHex } from './encoding/toHex.js';\n/** @internal */\nexport function serializeStateMapping(stateMapping) {\n if (!stateMapping || stateMapping.length === 0)\n return undefined;\n return stateMapping.reduce((acc, { slot, value }) => {\n if (slot.length !== 66)\n throw new InvalidBytesLengthError({\n size: slot.length,\n targetSize: 66,\n type: 'hex',\n });\n if (value.length !== 66)\n throw new InvalidBytesLengthError({\n size: value.length,\n targetSize: 66,\n type: 'hex',\n });\n acc[slot] = value;\n return acc;\n }, {});\n}\n/** @internal */\nexport function serializeAccountStateOverride(parameters) {\n const { balance, nonce, state, stateDiff, code } = parameters;\n const rpcAccountStateOverride = {};\n if (code !== undefined)\n rpcAccountStateOverride.code = code;\n if (balance !== undefined)\n rpcAccountStateOverride.balance = numberToHex(balance);\n if (nonce !== undefined)\n rpcAccountStateOverride.nonce = numberToHex(nonce);\n if (state !== undefined)\n rpcAccountStateOverride.state = serializeStateMapping(state);\n if (stateDiff !== undefined) {\n if (rpcAccountStateOverride.state)\n throw new StateAssignmentConflictError();\n rpcAccountStateOverride.stateDiff = serializeStateMapping(stateDiff);\n }\n return rpcAccountStateOverride;\n}\n/** @internal */\nexport function serializeStateOverride(parameters) {\n if (!parameters)\n return undefined;\n const rpcStateOverride = {};\n for (const { address, ...accountState } of parameters) {\n if (!isAddress(address, { strict: false }))\n throw new InvalidAddressError({ address });\n if (rpcStateOverride[address])\n throw new AccountStateConflictError({ address: address });\n rpcStateOverride[address] = serializeAccountStateOverride(accountState);\n }\n return rpcStateOverride;\n}\n//# sourceMappingURL=stateOverride.js.map","import { parseAccount, } from '../../accounts/utils/parseAccount.js';\nimport { maxUint256 } from '../../constants/number.js';\nimport { InvalidAddressError, } from '../../errors/address.js';\nimport { FeeCapTooHighError, TipAboveFeeCapError, } from '../../errors/node.js';\nimport { FeeConflictError, } from '../../errors/transaction.js';\nimport { isAddress } from '../address/isAddress.js';\nexport function assertRequest(args) {\n const { account: account_, gasPrice, maxFeePerGas, maxPriorityFeePerGas, to, } = args;\n const account = account_ ? parseAccount(account_) : undefined;\n if (account && !isAddress(account.address))\n throw new InvalidAddressError({ address: account.address });\n if (to && !isAddress(to))\n throw new InvalidAddressError({ address: to });\n if (typeof gasPrice !== 'undefined' &&\n (typeof maxFeePerGas !== 'undefined' ||\n typeof maxPriorityFeePerGas !== 'undefined'))\n throw new FeeConflictError();\n if (maxFeePerGas && maxFeePerGas > maxUint256)\n throw new FeeCapTooHighError({ maxFeePerGas });\n if (maxPriorityFeePerGas &&\n maxFeePerGas &&\n maxPriorityFeePerGas > maxFeePerGas)\n throw new TipAboveFeeCapError({ maxFeePerGas, maxPriorityFeePerGas });\n}\n//# sourceMappingURL=assertRequest.js.map","import { numberToHex, } from '../../utils/encoding/toHex.js';\n/**\n * Returns the balance of an address in wei.\n *\n * - Docs: https://viem.sh/docs/actions/public/getBalance\n * - JSON-RPC Methods: [`eth_getBalance`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getbalance)\n *\n * You can convert the balance to ether units with [`formatEther`](https://viem.sh/docs/utilities/formatEther).\n *\n * ```ts\n * const balance = await getBalance(client, {\n * address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',\n * blockTag: 'safe'\n * })\n * const balanceAsEther = formatEther(balance)\n * // \"6.942\"\n * ```\n *\n * @param client - Client to use\n * @param parameters - {@link GetBalanceParameters}\n * @returns The balance of the address in wei. {@link GetBalanceReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { getBalance } from 'viem/public'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const balance = await getBalance(client, {\n * address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',\n * })\n * // 10000000000000000000000n (wei)\n */\nexport async function getBalance(client, { address, blockNumber, blockTag = 'latest' }) {\n const blockNumberHex = blockNumber ? numberToHex(blockNumber) : undefined;\n const balance = await client.request({\n method: 'eth_getBalance',\n params: [address, blockNumberHex || blockTag],\n });\n return BigInt(balance);\n}\n//# sourceMappingURL=getBalance.js.map","import { parseAccount, } from '../../accounts/utils/parseAccount.js';\nimport { BaseError } from '../../errors/base.js';\nimport { recoverAuthorizationAddress, } from '../../experimental/eip7702/utils/recoverAuthorizationAddress.js';\nimport { numberToHex, } from '../../utils/encoding/toHex.js';\nimport { getEstimateGasError, } from '../../utils/errors/getEstimateGasError.js';\nimport { extract } from '../../utils/formatters/extract.js';\nimport { formatTransactionRequest, } from '../../utils/formatters/transactionRequest.js';\nimport { serializeStateOverride } from '../../utils/stateOverride.js';\nimport { assertRequest, } from '../../utils/transaction/assertRequest.js';\nimport { prepareTransactionRequest, } from '../wallet/prepareTransactionRequest.js';\nimport { getBalance } from './getBalance.js';\n/**\n * Estimates the gas necessary to complete a transaction without submitting it to the network.\n *\n * - Docs: https://viem.sh/docs/actions/public/estimateGas\n * - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)\n *\n * @param client - Client to use\n * @param parameters - {@link EstimateGasParameters}\n * @returns The gas estimate (in wei). {@link EstimateGasReturnType}\n *\n * @example\n * import { createPublicClient, http, parseEther } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { estimateGas } from 'viem/public'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const gasEstimate = await estimateGas(client, {\n * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',\n * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',\n * value: parseEther('1'),\n * })\n */\nexport async function estimateGas(client, args) {\n const account_ = args.account ?? client.account;\n const account = account_ ? parseAccount(account_) : undefined;\n try {\n const { accessList, authorizationList, blobs, blobVersionedHashes, blockNumber, blockTag, data, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, value, stateOverride, ...rest } = (await prepareTransactionRequest(client, {\n ...args,\n parameters: \n // Some RPC Providers do not compute versioned hashes from blobs. We will need\n // to compute them.\n account?.type === 'local' ? undefined : ['blobVersionedHashes'],\n }));\n const blockNumberHex = blockNumber ? numberToHex(blockNumber) : undefined;\n const block = blockNumberHex || blockTag;\n const rpcStateOverride = serializeStateOverride(stateOverride);\n const to = await (async () => {\n // If `to` exists on the parameters, use that.\n if (rest.to)\n return rest.to;\n // If no `to` exists, and we are sending a EIP-7702 transaction, use the\n // address of the first authorization in the list.\n if (authorizationList && authorizationList.length > 0)\n return await recoverAuthorizationAddress({\n authorization: authorizationList[0],\n }).catch(() => {\n throw new BaseError('`to` is required. Could not infer from `authorizationList`');\n });\n // Otherwise, we are sending a deployment transaction.\n return undefined;\n })();\n assertRequest(args);\n const chainFormat = client.chain?.formatters?.transactionRequest?.format;\n const format = chainFormat || formatTransactionRequest;\n const request = format({\n // Pick out extra data that might exist on the chain's transaction request type.\n ...extract(rest, { format: chainFormat }),\n from: account?.address,\n accessList,\n authorizationList,\n blobs,\n blobVersionedHashes,\n data,\n gas,\n gasPrice,\n maxFeePerBlobGas,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value,\n });\n function estimateGas_rpc(parameters) {\n const { block, request, rpcStateOverride } = parameters;\n return client.request({\n method: 'eth_estimateGas',\n params: rpcStateOverride\n ? [request, block ?? 'latest', rpcStateOverride]\n : block\n ? [request, block]\n : [request],\n });\n }\n let estimate = BigInt(await estimateGas_rpc({ block, request, rpcStateOverride }));\n // TODO(7702): Remove this once https://github.com/ethereum/execution-apis/issues/561 is resolved.\n // Authorization list schema is not implemented on JSON-RPC spec yet, so we need to\n // manually estimate the gas.\n if (authorizationList) {\n const value = await getBalance(client, { address: request.from });\n const estimates = await Promise.all(authorizationList.map(async (authorization) => {\n const { contractAddress } = authorization;\n const estimate = await estimateGas_rpc({\n block,\n request: {\n authorizationList: undefined,\n data,\n from: account?.address,\n to: contractAddress,\n value: numberToHex(value),\n },\n rpcStateOverride,\n }).catch(() => 100000n);\n return 2n * BigInt(estimate);\n }));\n estimate += estimates.reduce((acc, curr) => acc + curr, 0n);\n }\n return estimate;\n }\n catch (err) {\n throw getEstimateGasError(err, {\n ...args,\n account,\n chain: client.chain,\n });\n }\n}\n//# sourceMappingURL=estimateGas.js.map","import { hexToNumber, } from '../../utils/encoding/fromHex.js';\nimport { numberToHex, } from '../../utils/encoding/toHex.js';\n/**\n * Returns the number of [Transactions](https://viem.sh/docs/glossary/terms#transaction) an Account has sent.\n *\n * - Docs: https://viem.sh/docs/actions/public/getTransactionCount\n * - JSON-RPC Methods: [`eth_getTransactionCount`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactioncount)\n *\n * @param client - Client to use\n * @param parameters - {@link GetTransactionCountParameters}\n * @returns The number of transactions an account has sent. {@link GetTransactionCountReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { getTransactionCount } from 'viem/public'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const transactionCount = await getTransactionCount(client, {\n * address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',\n * })\n */\nexport async function getTransactionCount(client, { address, blockTag = 'latest', blockNumber }) {\n const count = await client.request({\n method: 'eth_getTransactionCount',\n params: [address, blockNumber ? numberToHex(blockNumber) : blockTag],\n }, { dedupe: Boolean(blockNumber) });\n return hexToNumber(count);\n}\n//# sourceMappingURL=getTransactionCount.js.map","import { hexToNumber, } from '../../utils/encoding/fromHex.js';\n/**\n * Returns the chain ID associated with the current network.\n *\n * - Docs: https://viem.sh/docs/actions/public/getChainId\n * - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid)\n *\n * @param client - Client to use\n * @returns The current chain ID. {@link GetChainIdReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { getChainId } from 'viem/public'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const chainId = await getChainId(client)\n * // 1\n */\nexport async function getChainId(client) {\n const chainIdHex = await client.request({\n method: 'eth_chainId',\n }, { dedupe: true });\n return hexToNumber(chainIdHex);\n}\n//# sourceMappingURL=getChainId.js.map","import { parseAccount, } from '../../accounts/utils/parseAccount.js';\nimport { internal_estimateFeesPerGas, } from '../../actions/public/estimateFeesPerGas.js';\nimport { estimateGas, } from '../../actions/public/estimateGas.js';\nimport { getBlock as getBlock_, } from '../../actions/public/getBlock.js';\nimport { getTransactionCount, } from '../../actions/public/getTransactionCount.js';\nimport { Eip1559FeesNotSupportedError, MaxFeePerGasTooLowError, } from '../../errors/fee.js';\nimport { blobsToCommitments } from '../../utils/blob/blobsToCommitments.js';\nimport { blobsToProofs } from '../../utils/blob/blobsToProofs.js';\nimport { commitmentsToVersionedHashes } from '../../utils/blob/commitmentsToVersionedHashes.js';\nimport { toBlobSidecars } from '../../utils/blob/toBlobSidecars.js';\nimport { getAction } from '../../utils/getAction.js';\nimport { assertRequest, } from '../../utils/transaction/assertRequest.js';\nimport { getTransactionType, } from '../../utils/transaction/getTransactionType.js';\nimport { getChainId as getChainId_ } from '../public/getChainId.js';\nexport const defaultParameters = [\n 'blobVersionedHashes',\n 'chainId',\n 'fees',\n 'gas',\n 'nonce',\n 'type',\n];\n/**\n * Prepares a transaction request for signing.\n *\n * - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest\n *\n * @param args - {@link PrepareTransactionRequestParameters}\n * @returns The transaction request. {@link PrepareTransactionRequestReturnType}\n *\n * @example\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { prepareTransactionRequest } from 'viem/actions'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n * const request = await prepareTransactionRequest(client, {\n * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',\n * to: '0x0000000000000000000000000000000000000000',\n * value: 1n,\n * })\n *\n * @example\n * // Account Hoisting\n * import { createWalletClient, http } from 'viem'\n * import { privateKeyToAccount } from 'viem/accounts'\n * import { mainnet } from 'viem/chains'\n * import { prepareTransactionRequest } from 'viem/actions'\n *\n * const client = createWalletClient({\n * account: privateKeyToAccount('0x…'),\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n * const request = await prepareTransactionRequest(client, {\n * to: '0x0000000000000000000000000000000000000000',\n * value: 1n,\n * })\n */\nexport async function prepareTransactionRequest(client, args) {\n const { account: account_ = client.account, blobs, chain, gas, kzg, nonce, nonceManager, parameters = defaultParameters, type, } = args;\n const account = account_ ? parseAccount(account_) : undefined;\n const request = { ...args, ...(account ? { from: account?.address } : {}) };\n let block;\n async function getBlock() {\n if (block)\n return block;\n block = await getAction(client, getBlock_, 'getBlock')({ blockTag: 'latest' });\n return block;\n }\n let chainId;\n async function getChainId() {\n if (chainId)\n return chainId;\n if (chain)\n return chain.id;\n if (typeof args.chainId !== 'undefined')\n return args.chainId;\n const chainId_ = await getAction(client, getChainId_, 'getChainId')({});\n chainId = chainId_;\n return chainId;\n }\n if ((parameters.includes('blobVersionedHashes') ||\n parameters.includes('sidecars')) &&\n blobs &&\n kzg) {\n const commitments = blobsToCommitments({ blobs, kzg });\n if (parameters.includes('blobVersionedHashes')) {\n const versionedHashes = commitmentsToVersionedHashes({\n commitments,\n to: 'hex',\n });\n request.blobVersionedHashes = versionedHashes;\n }\n if (parameters.includes('sidecars')) {\n const proofs = blobsToProofs({ blobs, commitments, kzg });\n const sidecars = toBlobSidecars({\n blobs,\n commitments,\n proofs,\n to: 'hex',\n });\n request.sidecars = sidecars;\n }\n }\n if (parameters.includes('chainId'))\n request.chainId = await getChainId();\n if (parameters.includes('nonce') && typeof nonce === 'undefined' && account) {\n if (nonceManager) {\n const chainId = await getChainId();\n request.nonce = await nonceManager.consume({\n address: account.address,\n chainId,\n client,\n });\n }\n else {\n request.nonce = await getAction(client, getTransactionCount, 'getTransactionCount')({\n address: account.address,\n blockTag: 'pending',\n });\n }\n }\n if ((parameters.includes('fees') || parameters.includes('type')) &&\n typeof type === 'undefined') {\n try {\n request.type = getTransactionType(request);\n }\n catch {\n // infer type from block\n const block = await getBlock();\n request.type =\n typeof block?.baseFeePerGas === 'bigint' ? 'eip1559' : 'legacy';\n }\n }\n if (parameters.includes('fees')) {\n // TODO(4844): derive blob base fees once https://github.com/ethereum/execution-apis/pull/486 is merged.\n if (request.type !== 'legacy' && request.type !== 'eip2930') {\n // EIP-1559 fees\n if (typeof request.maxFeePerGas === 'undefined' ||\n typeof request.maxPriorityFeePerGas === 'undefined') {\n const block = await getBlock();\n const { maxFeePerGas, maxPriorityFeePerGas } = await internal_estimateFeesPerGas(client, {\n block: block,\n chain,\n request: request,\n });\n if (typeof args.maxPriorityFeePerGas === 'undefined' &&\n args.maxFeePerGas &&\n args.maxFeePerGas < maxPriorityFeePerGas)\n throw new MaxFeePerGasTooLowError({\n maxPriorityFeePerGas,\n });\n request.maxPriorityFeePerGas = maxPriorityFeePerGas;\n request.maxFeePerGas = maxFeePerGas;\n }\n }\n else {\n // Legacy fees\n if (typeof args.maxFeePerGas !== 'undefined' ||\n typeof args.maxPriorityFeePerGas !== 'undefined')\n throw new Eip1559FeesNotSupportedError();\n const block = await getBlock();\n const { gasPrice: gasPrice_ } = await internal_estimateFeesPerGas(client, {\n block: block,\n chain,\n request: request,\n type: 'legacy',\n });\n request.gasPrice = gasPrice_;\n }\n }\n if (parameters.includes('gas') && typeof gas === 'undefined')\n request.gas = await getAction(client, estimateGas, 'estimateGas')({\n ...request,\n account: account\n ? { address: account.address, type: 'json-rpc' }\n : undefined,\n });\n assertRequest(request);\n delete request.parameters;\n return request;\n}\n//# sourceMappingURL=prepareTransactionRequest.js.map","import { BaseError } from './base.js';\nexport class AccountNotFoundError extends BaseError {\n constructor({ docsPath } = {}) {\n super([\n 'Could not find an Account to execute with this Action.',\n 'Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client.',\n ].join('\\n'), {\n docsPath,\n docsSlug: 'account',\n name: 'AccountNotFoundError',\n });\n }\n}\nexport class AccountTypeNotSupportedError extends BaseError {\n constructor({ docsPath, metaMessages, type, }) {\n super(`Account type \"${type}\" is not supported.`, {\n docsPath,\n metaMessages,\n name: 'AccountTypeNotSupportedError',\n });\n }\n}\n//# sourceMappingURL=account.js.map","// https://docs.soliditylang.org/en/v0.8.16/control-structures.html#panic-via-assert-and-error-via-require\nexport const panicReasons = {\n 1: 'An `assert` condition failed.',\n 17: 'Arithmetic operation resulted in underflow or overflow.',\n 18: 'Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).',\n 33: 'Attempted to convert to an invalid type.',\n 34: 'Attempted to access a storage byte array that is incorrectly encoded.',\n 49: 'Performed `.pop()` on an empty array',\n 50: 'Array index is out of bounds.',\n 65: 'Allocated too much memory or created an array which is too large.',\n 81: 'Attempted to call a zero-initialized variable of internal function type.',\n};\nexport const solidityError = {\n inputs: [\n {\n name: 'message',\n type: 'string',\n },\n ],\n name: 'Error',\n type: 'error',\n};\nexport const solidityPanic = {\n inputs: [\n {\n name: 'reason',\n type: 'uint256',\n },\n ],\n name: 'Panic',\n type: 'error',\n};\n//# sourceMappingURL=solidity.js.map","import { InvalidDefinitionTypeError, } from '../../errors/abi.js';\nexport function formatAbiItem(abiItem, { includeName = false } = {}) {\n if (abiItem.type !== 'function' &&\n abiItem.type !== 'event' &&\n abiItem.type !== 'error')\n throw new InvalidDefinitionTypeError(abiItem.type);\n return `${abiItem.name}(${formatAbiParams(abiItem.inputs, { includeName })})`;\n}\nexport function formatAbiParams(params, { includeName = false } = {}) {\n if (!params)\n return '';\n return params\n .map((param) => formatAbiParam(param, { includeName }))\n .join(includeName ? ', ' : ',');\n}\nfunction formatAbiParam(param, { includeName }) {\n if (param.type.startsWith('tuple')) {\n return `(${formatAbiParams(param.components, { includeName })})${param.type.slice('tuple'.length)}`;\n }\n return param.type + (includeName && param.name ? ` ${param.name}` : '');\n}\n//# sourceMappingURL=formatAbiItem.js.map","import { formatAbiItem, formatAbiParams } from '../utils/abi/formatAbiItem.js';\nimport { size } from '../utils/data/size.js';\nimport { BaseError } from './base.js';\nexport class AbiConstructorNotFoundError extends BaseError {\n constructor({ docsPath }) {\n super([\n 'A constructor was not found on the ABI.',\n 'Make sure you are using the correct ABI and that the constructor exists on it.',\n ].join('\\n'), {\n docsPath,\n name: 'AbiConstructorNotFoundError',\n });\n }\n}\nexport class AbiConstructorParamsNotFoundError extends BaseError {\n constructor({ docsPath }) {\n super([\n 'Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.',\n 'Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists.',\n ].join('\\n'), {\n docsPath,\n name: 'AbiConstructorParamsNotFoundError',\n });\n }\n}\nexport class AbiDecodingDataSizeInvalidError extends BaseError {\n constructor({ data, size }) {\n super([\n `Data size of ${size} bytes is invalid.`,\n 'Size must be in increments of 32 bytes (size % 32 === 0).',\n ].join('\\n'), {\n metaMessages: [`Data: ${data} (${size} bytes)`],\n name: 'AbiDecodingDataSizeInvalidError',\n });\n }\n}\nexport class AbiDecodingDataSizeTooSmallError extends BaseError {\n constructor({ data, params, size, }) {\n super([`Data size of ${size} bytes is too small for given parameters.`].join('\\n'), {\n metaMessages: [\n `Params: (${formatAbiParams(params, { includeName: true })})`,\n `Data: ${data} (${size} bytes)`,\n ],\n name: 'AbiDecodingDataSizeTooSmallError',\n });\n Object.defineProperty(this, \"data\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"params\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"size\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.data = data;\n this.params = params;\n this.size = size;\n }\n}\nexport class AbiDecodingZeroDataError extends BaseError {\n constructor() {\n super('Cannot decode zero data (\"0x\") with ABI parameters.', {\n name: 'AbiDecodingZeroDataError',\n });\n }\n}\nexport class AbiEncodingArrayLengthMismatchError extends BaseError {\n constructor({ expectedLength, givenLength, type, }) {\n super([\n `ABI encoding array length mismatch for type ${type}.`,\n `Expected length: ${expectedLength}`,\n `Given length: ${givenLength}`,\n ].join('\\n'), { name: 'AbiEncodingArrayLengthMismatchError' });\n }\n}\nexport class AbiEncodingBytesSizeMismatchError extends BaseError {\n constructor({ expectedSize, value }) {\n super(`Size of bytes \"${value}\" (bytes${size(value)}) does not match expected size (bytes${expectedSize}).`, { name: 'AbiEncodingBytesSizeMismatchError' });\n }\n}\nexport class AbiEncodingLengthMismatchError extends BaseError {\n constructor({ expectedLength, givenLength, }) {\n super([\n 'ABI encoding params/values length mismatch.',\n `Expected length (params): ${expectedLength}`,\n `Given length (values): ${givenLength}`,\n ].join('\\n'), { name: 'AbiEncodingLengthMismatchError' });\n }\n}\nexport class AbiErrorInputsNotFoundError extends BaseError {\n constructor(errorName, { docsPath }) {\n super([\n `Arguments (\\`args\\`) were provided to \"${errorName}\", but \"${errorName}\" on the ABI does not contain any parameters (\\`inputs\\`).`,\n 'Cannot encode error result without knowing what the parameter types are.',\n 'Make sure you are using the correct ABI and that the inputs exist on it.',\n ].join('\\n'), {\n docsPath,\n name: 'AbiErrorInputsNotFoundError',\n });\n }\n}\nexport class AbiErrorNotFoundError extends BaseError {\n constructor(errorName, { docsPath } = {}) {\n super([\n `Error ${errorName ? `\"${errorName}\" ` : ''}not found on ABI.`,\n 'Make sure you are using the correct ABI and that the error exists on it.',\n ].join('\\n'), {\n docsPath,\n name: 'AbiErrorNotFoundError',\n });\n }\n}\nexport class AbiErrorSignatureNotFoundError extends BaseError {\n constructor(signature, { docsPath }) {\n super([\n `Encoded error signature \"${signature}\" not found on ABI.`,\n 'Make sure you are using the correct ABI and that the error exists on it.',\n `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${signature}.`,\n ].join('\\n'), {\n docsPath,\n name: 'AbiErrorSignatureNotFoundError',\n });\n Object.defineProperty(this, \"signature\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.signature = signature;\n }\n}\nexport class AbiEventSignatureEmptyTopicsError extends BaseError {\n constructor({ docsPath }) {\n super('Cannot extract event signature from empty topics.', {\n docsPath,\n name: 'AbiEventSignatureEmptyTopicsError',\n });\n }\n}\nexport class AbiEventSignatureNotFoundError extends BaseError {\n constructor(signature, { docsPath }) {\n super([\n `Encoded event signature \"${signature}\" not found on ABI.`,\n 'Make sure you are using the correct ABI and that the event exists on it.',\n `You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.`,\n ].join('\\n'), {\n docsPath,\n name: 'AbiEventSignatureNotFoundError',\n });\n }\n}\nexport class AbiEventNotFoundError extends BaseError {\n constructor(eventName, { docsPath } = {}) {\n super([\n `Event ${eventName ? `\"${eventName}\" ` : ''}not found on ABI.`,\n 'Make sure you are using the correct ABI and that the event exists on it.',\n ].join('\\n'), {\n docsPath,\n name: 'AbiEventNotFoundError',\n });\n }\n}\nexport class AbiFunctionNotFoundError extends BaseError {\n constructor(functionName, { docsPath } = {}) {\n super([\n `Function ${functionName ? `\"${functionName}\" ` : ''}not found on ABI.`,\n 'Make sure you are using the correct ABI and that the function exists on it.',\n ].join('\\n'), {\n docsPath,\n name: 'AbiFunctionNotFoundError',\n });\n }\n}\nexport class AbiFunctionOutputsNotFoundError extends BaseError {\n constructor(functionName, { docsPath }) {\n super([\n `Function \"${functionName}\" does not contain any \\`outputs\\` on ABI.`,\n 'Cannot decode function result without knowing what the parameter types are.',\n 'Make sure you are using the correct ABI and that the function exists on it.',\n ].join('\\n'), {\n docsPath,\n name: 'AbiFunctionOutputsNotFoundError',\n });\n }\n}\nexport class AbiFunctionSignatureNotFoundError extends BaseError {\n constructor(signature, { docsPath }) {\n super([\n `Encoded function signature \"${signature}\" not found on ABI.`,\n 'Make sure you are using the correct ABI and that the function exists on it.',\n `You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.`,\n ].join('\\n'), {\n docsPath,\n name: 'AbiFunctionSignatureNotFoundError',\n });\n }\n}\nexport class AbiItemAmbiguityError extends BaseError {\n constructor(x, y) {\n super('Found ambiguous types in overloaded ABI items.', {\n metaMessages: [\n `\\`${x.type}\\` in \\`${formatAbiItem(x.abiItem)}\\`, and`,\n `\\`${y.type}\\` in \\`${formatAbiItem(y.abiItem)}\\``,\n '',\n 'These types encode differently and cannot be distinguished at runtime.',\n 'Remove one of the ambiguous items in the ABI.',\n ],\n name: 'AbiItemAmbiguityError',\n });\n }\n}\nexport class BytesSizeMismatchError extends BaseError {\n constructor({ expectedSize, givenSize, }) {\n super(`Expected bytes${expectedSize}, got bytes${givenSize}.`, {\n name: 'BytesSizeMismatchError',\n });\n }\n}\nexport class DecodeLogDataMismatch extends BaseError {\n constructor({ abiItem, data, params, size, }) {\n super([\n `Data size of ${size} bytes is too small for non-indexed event parameters.`,\n ].join('\\n'), {\n metaMessages: [\n `Params: (${formatAbiParams(params, { includeName: true })})`,\n `Data: ${data} (${size} bytes)`,\n ],\n name: 'DecodeLogDataMismatch',\n });\n Object.defineProperty(this, \"abiItem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"data\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"params\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"size\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.abiItem = abiItem;\n this.data = data;\n this.params = params;\n this.size = size;\n }\n}\nexport class DecodeLogTopicsMismatch extends BaseError {\n constructor({ abiItem, param, }) {\n super([\n `Expected a topic for indexed event parameter${param.name ? ` \"${param.name}\"` : ''} on event \"${formatAbiItem(abiItem, { includeName: true })}\".`,\n ].join('\\n'), { name: 'DecodeLogTopicsMismatch' });\n Object.defineProperty(this, \"abiItem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.abiItem = abiItem;\n }\n}\nexport class InvalidAbiEncodingTypeError extends BaseError {\n constructor(type, { docsPath }) {\n super([\n `Type \"${type}\" is not a valid encoding type.`,\n 'Please provide a valid ABI type.',\n ].join('\\n'), { docsPath, name: 'InvalidAbiEncodingType' });\n }\n}\nexport class InvalidAbiDecodingTypeError extends BaseError {\n constructor(type, { docsPath }) {\n super([\n `Type \"${type}\" is not a valid decoding type.`,\n 'Please provide a valid ABI type.',\n ].join('\\n'), { docsPath, name: 'InvalidAbiDecodingType' });\n }\n}\nexport class InvalidArrayError extends BaseError {\n constructor(value) {\n super([`Value \"${value}\" is not a valid array.`].join('\\n'), {\n name: 'InvalidArrayError',\n });\n }\n}\nexport class InvalidDefinitionTypeError extends BaseError {\n constructor(type) {\n super([\n `\"${type}\" is not a valid definition type.`,\n 'Valid types: \"function\", \"event\", \"error\"',\n ].join('\\n'), { name: 'InvalidDefinitionTypeError' });\n }\n}\nexport class UnsupportedPackedAbiType extends BaseError {\n constructor(type) {\n super(`Type \"${type}\" is not supported for packed encoding.`, {\n name: 'UnsupportedPackedAbiType',\n });\n }\n}\n//# sourceMappingURL=abi.js.map","import { toBytes } from '../encoding/toBytes.js';\nimport { keccak256 } from './keccak256.js';\nconst hash = (value) => keccak256(toBytes(value));\nexport function hashSignature(sig) {\n return hash(sig);\n}\n//# sourceMappingURL=hashSignature.js.map","export const version = '1.0.6';\n//# sourceMappingURL=version.js.map","import { version } from './version.js';\nexport class BaseError extends Error {\n constructor(shortMessage, args = {}) {\n const details = args.cause instanceof BaseError\n ? args.cause.details\n : args.cause?.message\n ? args.cause.message\n : args.details;\n const docsPath = args.cause instanceof BaseError\n ? args.cause.docsPath || args.docsPath\n : args.docsPath;\n const message = [\n shortMessage || 'An error occurred.',\n '',\n ...(args.metaMessages ? [...args.metaMessages, ''] : []),\n ...(docsPath ? [`Docs: https://abitype.dev${docsPath}`] : []),\n ...(details ? [`Details: ${details}`] : []),\n `Version: abitype@${version}`,\n ].join('\\n');\n super(message);\n Object.defineProperty(this, \"details\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"docsPath\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"metaMessages\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"shortMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'AbiTypeError'\n });\n if (args.cause)\n this.cause = args.cause;\n this.details = details;\n this.docsPath = docsPath;\n this.metaMessages = args.metaMessages;\n this.shortMessage = shortMessage;\n }\n}\n//# sourceMappingURL=errors.js.map","// TODO: This looks cool. Need to check the performance of `new RegExp` versus defined inline though.\n// https://twitter.com/GabrielVergnaud/status/1622906834343366657\nexport function execTyped(regex, string) {\n const match = regex.exec(string);\n return match?.groups;\n}\n// `bytes`: binary type of `M` bytes, `0 < M <= 32`\n// https://regexr.com/6va55\nexport const bytesRegex = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/;\n// `(u)int`: (un)signed integer type of `M` bits, `0 < M <= 256`, `M % 8 == 0`\n// https://regexr.com/6v8hp\nexport const integerRegex = /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;\nexport const isTupleRegex = /^\\(.+?\\).*?$/;\n//# sourceMappingURL=regex.js.map","import { execTyped } from '../regex.js';\n// https://regexr.com/7f7rv\nconst tupleRegex = /^tuple(?(\\[(\\d*)\\])*)$/;\n/**\n * Formats {@link AbiParameter} to human-readable ABI parameter.\n *\n * @param abiParameter - ABI parameter\n * @returns Human-readable ABI parameter\n *\n * @example\n * const result = formatAbiParameter({ type: 'address', name: 'from' })\n * // ^? const result: 'address from'\n */\nexport function formatAbiParameter(abiParameter) {\n let type = abiParameter.type;\n if (tupleRegex.test(abiParameter.type) && 'components' in abiParameter) {\n type = '(';\n const length = abiParameter.components.length;\n for (let i = 0; i < length; i++) {\n const component = abiParameter.components[i];\n type += formatAbiParameter(component);\n if (i < length - 1)\n type += ', ';\n }\n const result = execTyped(tupleRegex, abiParameter.type);\n type += `)${result?.array ?? ''}`;\n return formatAbiParameter({\n ...abiParameter,\n type,\n });\n }\n // Add `indexed` to type if in `abiParameter`\n if ('indexed' in abiParameter && abiParameter.indexed)\n type = `${type} indexed`;\n // Return human-readable ABI parameter\n if (abiParameter.name)\n return `${type} ${abiParameter.name}`;\n return type;\n}\n//# sourceMappingURL=formatAbiParameter.js.map","import { formatAbiParameter, } from './formatAbiParameter.js';\n/**\n * Formats {@link AbiParameter}s to human-readable ABI parameters.\n *\n * @param abiParameters - ABI parameters\n * @returns Human-readable ABI parameters\n *\n * @example\n * const result = formatAbiParameters([\n * // ^? const result: 'address from, uint256 tokenId'\n * { type: 'address', name: 'from' },\n * { type: 'uint256', name: 'tokenId' },\n * ])\n */\nexport function formatAbiParameters(abiParameters) {\n let params = '';\n const length = abiParameters.length;\n for (let i = 0; i < length; i++) {\n const abiParameter = abiParameters[i];\n params += formatAbiParameter(abiParameter);\n if (i !== length - 1)\n params += ', ';\n }\n return params;\n}\n//# sourceMappingURL=formatAbiParameters.js.map","import { formatAbiParameters, } from './formatAbiParameters.js';\n/**\n * Formats ABI item (e.g. error, event, function) into human-readable ABI item\n *\n * @param abiItem - ABI item\n * @returns Human-readable ABI item\n */\nexport function formatAbiItem(abiItem) {\n if (abiItem.type === 'function')\n return `function ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})${abiItem.stateMutability && abiItem.stateMutability !== 'nonpayable'\n ? ` ${abiItem.stateMutability}`\n : ''}${abiItem.outputs.length\n ? ` returns (${formatAbiParameters(abiItem.outputs)})`\n : ''}`;\n if (abiItem.type === 'event')\n return `event ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`;\n if (abiItem.type === 'error')\n return `error ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`;\n if (abiItem.type === 'constructor')\n return `constructor(${formatAbiParameters(abiItem.inputs)})${abiItem.stateMutability === 'payable' ? ' payable' : ''}`;\n if (abiItem.type === 'fallback')\n return 'fallback()';\n return 'receive() external payable';\n}\n//# sourceMappingURL=formatAbiItem.js.map","import { execTyped } from '../../regex.js';\n// https://regexr.com/7gmok\nconst errorSignatureRegex = /^error (?[a-zA-Z$_][a-zA-Z0-9$_]*)\\((?.*?)\\)$/;\nexport function isErrorSignature(signature) {\n return errorSignatureRegex.test(signature);\n}\nexport function execErrorSignature(signature) {\n return execTyped(errorSignatureRegex, signature);\n}\n// https://regexr.com/7gmoq\nconst eventSignatureRegex = /^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\\((?.*?)\\)$/;\nexport function isEventSignature(signature) {\n return eventSignatureRegex.test(signature);\n}\nexport function execEventSignature(signature) {\n return execTyped(eventSignatureRegex, signature);\n}\n// https://regexr.com/7gmot\nconst functionSignatureRegex = /^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\\((?.*?)\\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\\s?\\((?.*?)\\))?$/;\nexport function isFunctionSignature(signature) {\n return functionSignatureRegex.test(signature);\n}\nexport function execFunctionSignature(signature) {\n return execTyped(functionSignatureRegex, signature);\n}\n// https://regexr.com/7gmp3\nconst structSignatureRegex = /^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \\{(?.*?)\\}$/;\nexport function isStructSignature(signature) {\n return structSignatureRegex.test(signature);\n}\nexport function execStructSignature(signature) {\n return execTyped(structSignatureRegex, signature);\n}\n// https://regexr.com/78u01\nconst constructorSignatureRegex = /^constructor\\((?.*?)\\)(?:\\s(?payable{1}))?$/;\nexport function isConstructorSignature(signature) {\n return constructorSignatureRegex.test(signature);\n}\nexport function execConstructorSignature(signature) {\n return execTyped(constructorSignatureRegex, signature);\n}\n// https://regexr.com/7srtn\nconst fallbackSignatureRegex = /^fallback\\(\\) external(?:\\s(?payable{1}))?$/;\nexport function isFallbackSignature(signature) {\n return fallbackSignatureRegex.test(signature);\n}\n// https://regexr.com/78u1k\nconst receiveSignatureRegex = /^receive\\(\\) external payable$/;\nexport function isReceiveSignature(signature) {\n return receiveSignatureRegex.test(signature);\n}\nexport const modifiers = new Set([\n 'memory',\n 'indexed',\n 'storage',\n 'calldata',\n]);\nexport const eventModifiers = new Set(['indexed']);\nexport const functionModifiers = new Set([\n 'calldata',\n 'memory',\n 'storage',\n]);\n//# sourceMappingURL=signatures.js.map","import { BaseError } from '../../errors.js';\nexport class InvalidAbiItemError extends BaseError {\n constructor({ signature }) {\n super('Failed to parse ABI item.', {\n details: `parseAbiItem(${JSON.stringify(signature, null, 2)})`,\n docsPath: '/api/human#parseabiitem-1',\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'InvalidAbiItemError'\n });\n }\n}\nexport class UnknownTypeError extends BaseError {\n constructor({ type }) {\n super('Unknown type.', {\n metaMessages: [\n `Type \"${type}\" is not a valid ABI type. Perhaps you forgot to include a struct signature?`,\n ],\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'UnknownTypeError'\n });\n }\n}\nexport class UnknownSolidityTypeError extends BaseError {\n constructor({ type }) {\n super('Unknown type.', {\n metaMessages: [`Type \"${type}\" is not a valid ABI type.`],\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'UnknownSolidityTypeError'\n });\n }\n}\n//# sourceMappingURL=abiItem.js.map","import { BaseError } from '../../errors.js';\nexport class InvalidAbiParameterError extends BaseError {\n constructor({ param }) {\n super('Failed to parse ABI parameter.', {\n details: `parseAbiParameter(${JSON.stringify(param, null, 2)})`,\n docsPath: '/api/human#parseabiparameter-1',\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'InvalidAbiParameterError'\n });\n }\n}\nexport class InvalidAbiParametersError extends BaseError {\n constructor({ params }) {\n super('Failed to parse ABI parameters.', {\n details: `parseAbiParameters(${JSON.stringify(params, null, 2)})`,\n docsPath: '/api/human#parseabiparameters-1',\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'InvalidAbiParametersError'\n });\n }\n}\nexport class InvalidParameterError extends BaseError {\n constructor({ param }) {\n super('Invalid ABI parameter.', {\n details: param,\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'InvalidParameterError'\n });\n }\n}\nexport class SolidityProtectedKeywordError extends BaseError {\n constructor({ param, name }) {\n super('Invalid ABI parameter.', {\n details: param,\n metaMessages: [\n `\"${name}\" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`,\n ],\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'SolidityProtectedKeywordError'\n });\n }\n}\nexport class InvalidModifierError extends BaseError {\n constructor({ param, type, modifier, }) {\n super('Invalid ABI parameter.', {\n details: param,\n metaMessages: [\n `Modifier \"${modifier}\" not allowed${type ? ` in \"${type}\" type` : ''}.`,\n ],\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'InvalidModifierError'\n });\n }\n}\nexport class InvalidFunctionModifierError extends BaseError {\n constructor({ param, type, modifier, }) {\n super('Invalid ABI parameter.', {\n details: param,\n metaMessages: [\n `Modifier \"${modifier}\" not allowed${type ? ` in \"${type}\" type` : ''}.`,\n `Data location can only be specified for array, struct, or mapping types, but \"${modifier}\" was given.`,\n ],\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'InvalidFunctionModifierError'\n });\n }\n}\nexport class InvalidAbiTypeParameterError extends BaseError {\n constructor({ abiParameter, }) {\n super('Invalid ABI parameter.', {\n details: JSON.stringify(abiParameter, null, 2),\n metaMessages: ['ABI parameter type is invalid.'],\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'InvalidAbiTypeParameterError'\n });\n }\n}\n//# sourceMappingURL=abiParameter.js.map","import { BaseError } from '../../errors.js';\nexport class InvalidSignatureError extends BaseError {\n constructor({ signature, type, }) {\n super(`Invalid ${type} signature.`, {\n details: signature,\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'InvalidSignatureError'\n });\n }\n}\nexport class UnknownSignatureError extends BaseError {\n constructor({ signature }) {\n super('Unknown signature.', {\n details: signature,\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'UnknownSignatureError'\n });\n }\n}\nexport class InvalidStructSignatureError extends BaseError {\n constructor({ signature }) {\n super('Invalid struct signature.', {\n details: signature,\n metaMessages: ['No properties exist.'],\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'InvalidStructSignatureError'\n });\n }\n}\n//# sourceMappingURL=signature.js.map","import { BaseError } from '../../errors.js';\nexport class CircularReferenceError extends BaseError {\n constructor({ type }) {\n super('Circular reference detected.', {\n metaMessages: [`Struct \"${type}\" is a circular reference.`],\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'CircularReferenceError'\n });\n }\n}\n//# sourceMappingURL=struct.js.map","import { BaseError } from '../../errors.js';\nexport class InvalidParenthesisError extends BaseError {\n constructor({ current, depth }) {\n super('Unbalanced parentheses.', {\n metaMessages: [\n `\"${current.trim()}\" has too many ${depth > 0 ? 'opening' : 'closing'} parentheses.`,\n ],\n details: `Depth \"${depth}\"`,\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'InvalidParenthesisError'\n });\n }\n}\n//# sourceMappingURL=splitParameters.js.map","/**\n * Gets {@link parameterCache} cache key namespaced by {@link type}. This prevents parameters from being accessible to types that don't allow them (e.g. `string indexed foo` not allowed outside of `type: 'event'`).\n * @param param ABI parameter string\n * @param type ABI parameter type\n * @returns Cache key for {@link parameterCache}\n */\nexport function getParameterCacheKey(param, type) {\n if (type)\n return `${type}:${param}`;\n return param;\n}\n/**\n * Basic cache seeded with common ABI parameter strings.\n *\n * **Note: When seeding more parameters, make sure you benchmark performance. The current number is the ideal balance between performance and having an already existing cache.**\n */\nexport const parameterCache = new Map([\n // Unnamed\n ['address', { type: 'address' }],\n ['bool', { type: 'bool' }],\n ['bytes', { type: 'bytes' }],\n ['bytes32', { type: 'bytes32' }],\n ['int', { type: 'int256' }],\n ['int256', { type: 'int256' }],\n ['string', { type: 'string' }],\n ['uint', { type: 'uint256' }],\n ['uint8', { type: 'uint8' }],\n ['uint16', { type: 'uint16' }],\n ['uint24', { type: 'uint24' }],\n ['uint32', { type: 'uint32' }],\n ['uint64', { type: 'uint64' }],\n ['uint96', { type: 'uint96' }],\n ['uint112', { type: 'uint112' }],\n ['uint160', { type: 'uint160' }],\n ['uint192', { type: 'uint192' }],\n ['uint256', { type: 'uint256' }],\n // Named\n ['address owner', { type: 'address', name: 'owner' }],\n ['address to', { type: 'address', name: 'to' }],\n ['bool approved', { type: 'bool', name: 'approved' }],\n ['bytes _data', { type: 'bytes', name: '_data' }],\n ['bytes data', { type: 'bytes', name: 'data' }],\n ['bytes signature', { type: 'bytes', name: 'signature' }],\n ['bytes32 hash', { type: 'bytes32', name: 'hash' }],\n ['bytes32 r', { type: 'bytes32', name: 'r' }],\n ['bytes32 root', { type: 'bytes32', name: 'root' }],\n ['bytes32 s', { type: 'bytes32', name: 's' }],\n ['string name', { type: 'string', name: 'name' }],\n ['string symbol', { type: 'string', name: 'symbol' }],\n ['string tokenURI', { type: 'string', name: 'tokenURI' }],\n ['uint tokenId', { type: 'uint256', name: 'tokenId' }],\n ['uint8 v', { type: 'uint8', name: 'v' }],\n ['uint256 balance', { type: 'uint256', name: 'balance' }],\n ['uint256 tokenId', { type: 'uint256', name: 'tokenId' }],\n ['uint256 value', { type: 'uint256', name: 'value' }],\n // Indexed\n [\n 'event:address indexed from',\n { type: 'address', name: 'from', indexed: true },\n ],\n ['event:address indexed to', { type: 'address', name: 'to', indexed: true }],\n [\n 'event:uint indexed tokenId',\n { type: 'uint256', name: 'tokenId', indexed: true },\n ],\n [\n 'event:uint256 indexed tokenId',\n { type: 'uint256', name: 'tokenId', indexed: true },\n ],\n]);\n//# sourceMappingURL=cache.js.map","import { bytesRegex, execTyped, integerRegex, isTupleRegex, } from '../../regex.js';\nimport { UnknownSolidityTypeError } from '../errors/abiItem.js';\nimport { InvalidFunctionModifierError, InvalidModifierError, InvalidParameterError, SolidityProtectedKeywordError, } from '../errors/abiParameter.js';\nimport { InvalidSignatureError, UnknownSignatureError, } from '../errors/signature.js';\nimport { InvalidParenthesisError } from '../errors/splitParameters.js';\nimport { getParameterCacheKey, parameterCache } from './cache.js';\nimport { eventModifiers, execConstructorSignature, execErrorSignature, execEventSignature, execFunctionSignature, functionModifiers, isConstructorSignature, isErrorSignature, isEventSignature, isFallbackSignature, isFunctionSignature, isReceiveSignature, } from './signatures.js';\nexport function parseSignature(signature, structs = {}) {\n if (isFunctionSignature(signature)) {\n const match = execFunctionSignature(signature);\n if (!match)\n throw new InvalidSignatureError({ signature, type: 'function' });\n const inputParams = splitParameters(match.parameters);\n const inputs = [];\n const inputLength = inputParams.length;\n for (let i = 0; i < inputLength; i++) {\n inputs.push(parseAbiParameter(inputParams[i], {\n modifiers: functionModifiers,\n structs,\n type: 'function',\n }));\n }\n const outputs = [];\n if (match.returns) {\n const outputParams = splitParameters(match.returns);\n const outputLength = outputParams.length;\n for (let i = 0; i < outputLength; i++) {\n outputs.push(parseAbiParameter(outputParams[i], {\n modifiers: functionModifiers,\n structs,\n type: 'function',\n }));\n }\n }\n return {\n name: match.name,\n type: 'function',\n stateMutability: match.stateMutability ?? 'nonpayable',\n inputs,\n outputs,\n };\n }\n if (isEventSignature(signature)) {\n const match = execEventSignature(signature);\n if (!match)\n throw new InvalidSignatureError({ signature, type: 'event' });\n const params = splitParameters(match.parameters);\n const abiParameters = [];\n const length = params.length;\n for (let i = 0; i < length; i++) {\n abiParameters.push(parseAbiParameter(params[i], {\n modifiers: eventModifiers,\n structs,\n type: 'event',\n }));\n }\n return { name: match.name, type: 'event', inputs: abiParameters };\n }\n if (isErrorSignature(signature)) {\n const match = execErrorSignature(signature);\n if (!match)\n throw new InvalidSignatureError({ signature, type: 'error' });\n const params = splitParameters(match.parameters);\n const abiParameters = [];\n const length = params.length;\n for (let i = 0; i < length; i++) {\n abiParameters.push(parseAbiParameter(params[i], { structs, type: 'error' }));\n }\n return { name: match.name, type: 'error', inputs: abiParameters };\n }\n if (isConstructorSignature(signature)) {\n const match = execConstructorSignature(signature);\n if (!match)\n throw new InvalidSignatureError({ signature, type: 'constructor' });\n const params = splitParameters(match.parameters);\n const abiParameters = [];\n const length = params.length;\n for (let i = 0; i < length; i++) {\n abiParameters.push(parseAbiParameter(params[i], { structs, type: 'constructor' }));\n }\n return {\n type: 'constructor',\n stateMutability: match.stateMutability ?? 'nonpayable',\n inputs: abiParameters,\n };\n }\n if (isFallbackSignature(signature))\n return { type: 'fallback' };\n if (isReceiveSignature(signature))\n return {\n type: 'receive',\n stateMutability: 'payable',\n };\n throw new UnknownSignatureError({ signature });\n}\nconst abiParameterWithoutTupleRegex = /^(?[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\\[\\d*?\\])+?)?(?:\\s(?calldata|indexed|memory|storage{1}))?(?:\\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/;\nconst abiParameterWithTupleRegex = /^\\((?.+?)\\)(?(?:\\[\\d*?\\])+?)?(?:\\s(?calldata|indexed|memory|storage{1}))?(?:\\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/;\nconst dynamicIntegerRegex = /^u?int$/;\nexport function parseAbiParameter(param, options) {\n // optional namespace cache by `type`\n const parameterCacheKey = getParameterCacheKey(param, options?.type);\n if (parameterCache.has(parameterCacheKey))\n return parameterCache.get(parameterCacheKey);\n const isTuple = isTupleRegex.test(param);\n const match = execTyped(isTuple ? abiParameterWithTupleRegex : abiParameterWithoutTupleRegex, param);\n if (!match)\n throw new InvalidParameterError({ param });\n if (match.name && isSolidityKeyword(match.name))\n throw new SolidityProtectedKeywordError({ param, name: match.name });\n const name = match.name ? { name: match.name } : {};\n const indexed = match.modifier === 'indexed' ? { indexed: true } : {};\n const structs = options?.structs ?? {};\n let type;\n let components = {};\n if (isTuple) {\n type = 'tuple';\n const params = splitParameters(match.type);\n const components_ = [];\n const length = params.length;\n for (let i = 0; i < length; i++) {\n // remove `modifiers` from `options` to prevent from being added to tuple components\n components_.push(parseAbiParameter(params[i], { structs }));\n }\n components = { components: components_ };\n }\n else if (match.type in structs) {\n type = 'tuple';\n components = { components: structs[match.type] };\n }\n else if (dynamicIntegerRegex.test(match.type)) {\n type = `${match.type}256`;\n }\n else {\n type = match.type;\n if (!(options?.type === 'struct') && !isSolidityType(type))\n throw new UnknownSolidityTypeError({ type });\n }\n if (match.modifier) {\n // Check if modifier exists, but is not allowed (e.g. `indexed` in `functionModifiers`)\n if (!options?.modifiers?.has?.(match.modifier))\n throw new InvalidModifierError({\n param,\n type: options?.type,\n modifier: match.modifier,\n });\n // Check if resolved `type` is valid if there is a function modifier\n if (functionModifiers.has(match.modifier) &&\n !isValidDataLocation(type, !!match.array))\n throw new InvalidFunctionModifierError({\n param,\n type: options?.type,\n modifier: match.modifier,\n });\n }\n const abiParameter = {\n type: `${type}${match.array ?? ''}`,\n ...name,\n ...indexed,\n ...components,\n };\n parameterCache.set(parameterCacheKey, abiParameter);\n return abiParameter;\n}\n// s/o latika for this\nexport function splitParameters(params, result = [], current = '', depth = 0) {\n const length = params.trim().length;\n // biome-ignore lint/correctness/noUnreachable: recursive\n for (let i = 0; i < length; i++) {\n const char = params[i];\n const tail = params.slice(i + 1);\n switch (char) {\n case ',':\n return depth === 0\n ? splitParameters(tail, [...result, current.trim()])\n : splitParameters(tail, result, `${current}${char}`, depth);\n case '(':\n return splitParameters(tail, result, `${current}${char}`, depth + 1);\n case ')':\n return splitParameters(tail, result, `${current}${char}`, depth - 1);\n default:\n return splitParameters(tail, result, `${current}${char}`, depth);\n }\n }\n if (current === '')\n return result;\n if (depth !== 0)\n throw new InvalidParenthesisError({ current, depth });\n result.push(current.trim());\n return result;\n}\nexport function isSolidityType(type) {\n return (type === 'address' ||\n type === 'bool' ||\n type === 'function' ||\n type === 'string' ||\n bytesRegex.test(type) ||\n integerRegex.test(type));\n}\nconst protectedKeywordsRegex = /^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;\n/** @internal */\nexport function isSolidityKeyword(name) {\n return (name === 'address' ||\n name === 'bool' ||\n name === 'function' ||\n name === 'string' ||\n name === 'tuple' ||\n bytesRegex.test(name) ||\n integerRegex.test(name) ||\n protectedKeywordsRegex.test(name));\n}\n/** @internal */\nexport function isValidDataLocation(type, isArray) {\n return isArray || type === 'bytes' || type === 'string' || type === 'tuple';\n}\n//# sourceMappingURL=utils.js.map","import { execTyped, isTupleRegex } from '../../regex.js';\nimport { UnknownTypeError } from '../errors/abiItem.js';\nimport { InvalidAbiTypeParameterError } from '../errors/abiParameter.js';\nimport { InvalidSignatureError, InvalidStructSignatureError, } from '../errors/signature.js';\nimport { CircularReferenceError } from '../errors/struct.js';\nimport { execStructSignature, isStructSignature } from './signatures.js';\nimport { isSolidityType, parseAbiParameter } from './utils.js';\nexport function parseStructs(signatures) {\n // Create \"shallow\" version of each struct (and filter out non-structs or invalid structs)\n const shallowStructs = {};\n const signaturesLength = signatures.length;\n for (let i = 0; i < signaturesLength; i++) {\n const signature = signatures[i];\n if (!isStructSignature(signature))\n continue;\n const match = execStructSignature(signature);\n if (!match)\n throw new InvalidSignatureError({ signature, type: 'struct' });\n const properties = match.properties.split(';');\n const components = [];\n const propertiesLength = properties.length;\n for (let k = 0; k < propertiesLength; k++) {\n const property = properties[k];\n const trimmed = property.trim();\n if (!trimmed)\n continue;\n const abiParameter = parseAbiParameter(trimmed, {\n type: 'struct',\n });\n components.push(abiParameter);\n }\n if (!components.length)\n throw new InvalidStructSignatureError({ signature });\n shallowStructs[match.name] = components;\n }\n // Resolve nested structs inside each parameter\n const resolvedStructs = {};\n const entries = Object.entries(shallowStructs);\n const entriesLength = entries.length;\n for (let i = 0; i < entriesLength; i++) {\n const [name, parameters] = entries[i];\n resolvedStructs[name] = resolveStructs(parameters, shallowStructs);\n }\n return resolvedStructs;\n}\nconst typeWithoutTupleRegex = /^(?[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\\[\\d*?\\])+?)?$/;\nfunction resolveStructs(abiParameters, structs, ancestors = new Set()) {\n const components = [];\n const length = abiParameters.length;\n for (let i = 0; i < length; i++) {\n const abiParameter = abiParameters[i];\n const isTuple = isTupleRegex.test(abiParameter.type);\n if (isTuple)\n components.push(abiParameter);\n else {\n const match = execTyped(typeWithoutTupleRegex, abiParameter.type);\n if (!match?.type)\n throw new InvalidAbiTypeParameterError({ abiParameter });\n const { array, type } = match;\n if (type in structs) {\n if (ancestors.has(type))\n throw new CircularReferenceError({ type });\n components.push({\n ...abiParameter,\n type: `tuple${array ?? ''}`,\n components: resolveStructs(structs[type] ?? [], structs, new Set([...ancestors, type])),\n });\n }\n else {\n if (isSolidityType(type))\n components.push(abiParameter);\n else\n throw new UnknownTypeError({ type });\n }\n }\n }\n return components;\n}\n//# sourceMappingURL=structs.js.map","import { isStructSignature } from './runtime/signatures.js';\nimport { parseStructs } from './runtime/structs.js';\nimport { parseSignature } from './runtime/utils.js';\n/**\n * Parses human-readable ABI into JSON {@link Abi}\n *\n * @param signatures - Human-Readable ABI\n * @returns Parsed {@link Abi}\n *\n * @example\n * const abi = parseAbi([\n * // ^? const abi: readonly [{ name: \"balanceOf\"; type: \"function\"; stateMutability:...\n * 'function balanceOf(address owner) view returns (uint256)',\n * 'event Transfer(address indexed from, address indexed to, uint256 amount)',\n * ])\n */\nexport function parseAbi(signatures) {\n const structs = parseStructs(signatures);\n const abi = [];\n const length = signatures.length;\n for (let i = 0; i < length; i++) {\n const signature = signatures[i];\n if (isStructSignature(signature))\n continue;\n abi.push(parseSignature(signature, structs));\n }\n return abi;\n}\n//# sourceMappingURL=parseAbi.js.map","import { BaseError } from '../../errors/base.js';\nexport function normalizeSignature(signature) {\n let active = true;\n let current = '';\n let level = 0;\n let result = '';\n let valid = false;\n for (let i = 0; i < signature.length; i++) {\n const char = signature[i];\n // If the character is a separator, we want to reactivate.\n if (['(', ')', ','].includes(char))\n active = true;\n // If the character is a \"level\" token, we want to increment/decrement.\n if (char === '(')\n level++;\n if (char === ')')\n level--;\n // If we aren't active, we don't want to mutate the result.\n if (!active)\n continue;\n // If level === 0, we are at the definition level.\n if (level === 0) {\n if (char === ' ' && ['event', 'function', ''].includes(result))\n result = '';\n else {\n result += char;\n // If we are at the end of the definition, we must be finished.\n if (char === ')') {\n valid = true;\n break;\n }\n }\n continue;\n }\n // Ignore spaces\n if (char === ' ') {\n // If the previous character is a separator, and the current section isn't empty, we want to deactivate.\n if (signature[i - 1] !== ',' && current !== ',' && current !== ',(') {\n current = '';\n active = false;\n }\n continue;\n }\n result += char;\n current += char;\n }\n if (!valid)\n throw new BaseError('Unable to normalize signature.');\n return result;\n}\n//# sourceMappingURL=normalizeSignature.js.map","import { formatAbiItem } from 'abitype';\nimport { normalizeSignature, } from './normalizeSignature.js';\n/**\n * Returns the signature for a given function or event definition.\n *\n * @example\n * const signature = toSignature('function ownerOf(uint256 tokenId)')\n * // 'ownerOf(uint256)'\n *\n * @example\n * const signature_3 = toSignature({\n * name: 'ownerOf',\n * type: 'function',\n * inputs: [{ name: 'tokenId', type: 'uint256' }],\n * outputs: [],\n * stateMutability: 'view',\n * })\n * // 'ownerOf(uint256)'\n */\nexport const toSignature = (def) => {\n const def_ = (() => {\n if (typeof def === 'string')\n return def;\n return formatAbiItem(def);\n })();\n return normalizeSignature(def_);\n};\n//# sourceMappingURL=toSignature.js.map","import { hashSignature } from './hashSignature.js';\nimport { toSignature } from './toSignature.js';\n/**\n * Returns the hash (of the function/event signature) for a given event or function definition.\n */\nexport function toSignatureHash(fn) {\n return hashSignature(toSignature(fn));\n}\n//# sourceMappingURL=toSignatureHash.js.map","import { slice } from '../data/slice.js';\nimport { toSignatureHash, } from './toSignatureHash.js';\n/**\n * Returns the function selector for a given function definition.\n *\n * @example\n * const selector = toFunctionSelector('function ownerOf(uint256 tokenId)')\n * // 0x6352211e\n */\nexport const toFunctionSelector = (fn) => slice(toSignatureHash(fn), 0, 4);\n//# sourceMappingURL=toFunctionSelector.js.map","import { InvalidBytesBooleanError } from '../../errors/encoding.js';\nimport { trim } from '../data/trim.js';\nimport { assertSize, hexToBigInt, hexToNumber, } from './fromHex.js';\nimport { bytesToHex } from './toHex.js';\n/**\n * Decodes a byte array into a UTF-8 string, hex value, number, bigint or boolean.\n *\n * - Docs: https://viem.sh/docs/utilities/fromBytes\n * - Example: https://viem.sh/docs/utilities/fromBytes#usage\n *\n * @param bytes Byte array to decode.\n * @param toOrOpts Type to convert to or options.\n * @returns Decoded value.\n *\n * @example\n * import { fromBytes } from 'viem'\n * const data = fromBytes(new Uint8Array([1, 164]), 'number')\n * // 420\n *\n * @example\n * import { fromBytes } from 'viem'\n * const data = fromBytes(\n * new Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]),\n * 'string'\n * )\n * // 'Hello world'\n */\nexport function fromBytes(bytes, toOrOpts) {\n const opts = typeof toOrOpts === 'string' ? { to: toOrOpts } : toOrOpts;\n const to = opts.to;\n if (to === 'number')\n return bytesToNumber(bytes, opts);\n if (to === 'bigint')\n return bytesToBigInt(bytes, opts);\n if (to === 'boolean')\n return bytesToBool(bytes, opts);\n if (to === 'string')\n return bytesToString(bytes, opts);\n return bytesToHex(bytes, opts);\n}\n/**\n * Decodes a byte array into a bigint.\n *\n * - Docs: https://viem.sh/docs/utilities/fromBytes#bytestobigint\n *\n * @param bytes Byte array to decode.\n * @param opts Options.\n * @returns BigInt value.\n *\n * @example\n * import { bytesToBigInt } from 'viem'\n * const data = bytesToBigInt(new Uint8Array([1, 164]))\n * // 420n\n */\nexport function bytesToBigInt(bytes, opts = {}) {\n if (typeof opts.size !== 'undefined')\n assertSize(bytes, { size: opts.size });\n const hex = bytesToHex(bytes, opts);\n return hexToBigInt(hex, opts);\n}\n/**\n * Decodes a byte array into a boolean.\n *\n * - Docs: https://viem.sh/docs/utilities/fromBytes#bytestobool\n *\n * @param bytes Byte array to decode.\n * @param opts Options.\n * @returns Boolean value.\n *\n * @example\n * import { bytesToBool } from 'viem'\n * const data = bytesToBool(new Uint8Array([1]))\n * // true\n */\nexport function bytesToBool(bytes_, opts = {}) {\n let bytes = bytes_;\n if (typeof opts.size !== 'undefined') {\n assertSize(bytes, { size: opts.size });\n bytes = trim(bytes);\n }\n if (bytes.length > 1 || bytes[0] > 1)\n throw new InvalidBytesBooleanError(bytes);\n return Boolean(bytes[0]);\n}\n/**\n * Decodes a byte array into a number.\n *\n * - Docs: https://viem.sh/docs/utilities/fromBytes#bytestonumber\n *\n * @param bytes Byte array to decode.\n * @param opts Options.\n * @returns Number value.\n *\n * @example\n * import { bytesToNumber } from 'viem'\n * const data = bytesToNumber(new Uint8Array([1, 164]))\n * // 420\n */\nexport function bytesToNumber(bytes, opts = {}) {\n if (typeof opts.size !== 'undefined')\n assertSize(bytes, { size: opts.size });\n const hex = bytesToHex(bytes, opts);\n return hexToNumber(hex, opts);\n}\n/**\n * Decodes a byte array into a UTF-8 string.\n *\n * - Docs: https://viem.sh/docs/utilities/fromBytes#bytestostring\n *\n * @param bytes Byte array to decode.\n * @param opts Options.\n * @returns String value.\n *\n * @example\n * import { bytesToString } from 'viem'\n * const data = bytesToString(new Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]))\n * // 'Hello world'\n */\nexport function bytesToString(bytes_, opts = {}) {\n let bytes = bytes_;\n if (typeof opts.size !== 'undefined') {\n assertSize(bytes, { size: opts.size });\n bytes = trim(bytes, { dir: 'right' });\n }\n return new TextDecoder().decode(bytes);\n}\n//# sourceMappingURL=fromBytes.js.map","import { AbiEncodingArrayLengthMismatchError, AbiEncodingBytesSizeMismatchError, AbiEncodingLengthMismatchError, InvalidAbiEncodingTypeError, InvalidArrayError, } from '../../errors/abi.js';\nimport { InvalidAddressError, } from '../../errors/address.js';\nimport { BaseError } from '../../errors/base.js';\nimport { isAddress } from '../address/isAddress.js';\nimport { concat } from '../data/concat.js';\nimport { padHex } from '../data/pad.js';\nimport { size } from '../data/size.js';\nimport { slice } from '../data/slice.js';\nimport { boolToHex, numberToHex, stringToHex, } from '../encoding/toHex.js';\n/**\n * @description Encodes a list of primitive values into an ABI-encoded hex value.\n *\n * - Docs: https://viem.sh/docs/abi/encodeAbiParameters#encodeabiparameters\n *\n * Generates ABI encoded data using the [ABI specification](https://docs.soliditylang.org/en/latest/abi-spec), given a set of ABI parameters (inputs/outputs) and their corresponding values.\n *\n * @param params - a set of ABI Parameters (params), that can be in the shape of the inputs or outputs attribute of an ABI Item.\n * @param values - a set of values (values) that correspond to the given params.\n * @example\n * ```typescript\n * import { encodeAbiParameters } from 'viem'\n *\n * const encodedData = encodeAbiParameters(\n * [\n * { name: 'x', type: 'string' },\n * { name: 'y', type: 'uint' },\n * { name: 'z', type: 'bool' }\n * ],\n * ['wagmi', 420n, true]\n * )\n * ```\n *\n * You can also pass in Human Readable parameters with the parseAbiParameters utility.\n *\n * @example\n * ```typescript\n * import { encodeAbiParameters, parseAbiParameters } from 'viem'\n *\n * const encodedData = encodeAbiParameters(\n * parseAbiParameters('string x, uint y, bool z'),\n * ['wagmi', 420n, true]\n * )\n * ```\n */\nexport function encodeAbiParameters(params, values) {\n if (params.length !== values.length)\n throw new AbiEncodingLengthMismatchError({\n expectedLength: params.length,\n givenLength: values.length,\n });\n // Prepare the parameters to determine dynamic types to encode.\n const preparedParams = prepareParams({\n params: params,\n values: values,\n });\n const data = encodeParams(preparedParams);\n if (data.length === 0)\n return '0x';\n return data;\n}\nfunction prepareParams({ params, values, }) {\n const preparedParams = [];\n for (let i = 0; i < params.length; i++) {\n preparedParams.push(prepareParam({ param: params[i], value: values[i] }));\n }\n return preparedParams;\n}\nfunction prepareParam({ param, value, }) {\n const arrayComponents = getArrayComponents(param.type);\n if (arrayComponents) {\n const [length, type] = arrayComponents;\n return encodeArray(value, { length, param: { ...param, type } });\n }\n if (param.type === 'tuple') {\n return encodeTuple(value, {\n param: param,\n });\n }\n if (param.type === 'address') {\n return encodeAddress(value);\n }\n if (param.type === 'bool') {\n return encodeBool(value);\n }\n if (param.type.startsWith('uint') || param.type.startsWith('int')) {\n const signed = param.type.startsWith('int');\n return encodeNumber(value, { signed });\n }\n if (param.type.startsWith('bytes')) {\n return encodeBytes(value, { param });\n }\n if (param.type === 'string') {\n return encodeString(value);\n }\n throw new InvalidAbiEncodingTypeError(param.type, {\n docsPath: '/docs/contract/encodeAbiParameters',\n });\n}\nfunction encodeParams(preparedParams) {\n // 1. Compute the size of the static part of the parameters.\n let staticSize = 0;\n for (let i = 0; i < preparedParams.length; i++) {\n const { dynamic, encoded } = preparedParams[i];\n if (dynamic)\n staticSize += 32;\n else\n staticSize += size(encoded);\n }\n // 2. Split the parameters into static and dynamic parts.\n const staticParams = [];\n const dynamicParams = [];\n let dynamicSize = 0;\n for (let i = 0; i < preparedParams.length; i++) {\n const { dynamic, encoded } = preparedParams[i];\n if (dynamic) {\n staticParams.push(numberToHex(staticSize + dynamicSize, { size: 32 }));\n dynamicParams.push(encoded);\n dynamicSize += size(encoded);\n }\n else {\n staticParams.push(encoded);\n }\n }\n // 3. Concatenate static and dynamic parts.\n return concat([...staticParams, ...dynamicParams]);\n}\nfunction encodeAddress(value) {\n if (!isAddress(value))\n throw new InvalidAddressError({ address: value });\n return { dynamic: false, encoded: padHex(value.toLowerCase()) };\n}\nfunction encodeArray(value, { length, param, }) {\n const dynamic = length === null;\n if (!Array.isArray(value))\n throw new InvalidArrayError(value);\n if (!dynamic && value.length !== length)\n throw new AbiEncodingArrayLengthMismatchError({\n expectedLength: length,\n givenLength: value.length,\n type: `${param.type}[${length}]`,\n });\n let dynamicChild = false;\n const preparedParams = [];\n for (let i = 0; i < value.length; i++) {\n const preparedParam = prepareParam({ param, value: value[i] });\n if (preparedParam.dynamic)\n dynamicChild = true;\n preparedParams.push(preparedParam);\n }\n if (dynamic || dynamicChild) {\n const data = encodeParams(preparedParams);\n if (dynamic) {\n const length = numberToHex(preparedParams.length, { size: 32 });\n return {\n dynamic: true,\n encoded: preparedParams.length > 0 ? concat([length, data]) : length,\n };\n }\n if (dynamicChild)\n return { dynamic: true, encoded: data };\n }\n return {\n dynamic: false,\n encoded: concat(preparedParams.map(({ encoded }) => encoded)),\n };\n}\nfunction encodeBytes(value, { param }) {\n const [, paramSize] = param.type.split('bytes');\n const bytesSize = size(value);\n if (!paramSize) {\n let value_ = value;\n // If the size is not divisible by 32 bytes, pad the end\n // with empty bytes to the ceiling 32 bytes.\n if (bytesSize % 32 !== 0)\n value_ = padHex(value_, {\n dir: 'right',\n size: Math.ceil((value.length - 2) / 2 / 32) * 32,\n });\n return {\n dynamic: true,\n encoded: concat([padHex(numberToHex(bytesSize, { size: 32 })), value_]),\n };\n }\n if (bytesSize !== Number.parseInt(paramSize))\n throw new AbiEncodingBytesSizeMismatchError({\n expectedSize: Number.parseInt(paramSize),\n value,\n });\n return { dynamic: false, encoded: padHex(value, { dir: 'right' }) };\n}\nfunction encodeBool(value) {\n if (typeof value !== 'boolean')\n throw new BaseError(`Invalid boolean value: \"${value}\" (type: ${typeof value}). Expected: \\`true\\` or \\`false\\`.`);\n return { dynamic: false, encoded: padHex(boolToHex(value)) };\n}\nfunction encodeNumber(value, { signed }) {\n return {\n dynamic: false,\n encoded: numberToHex(value, {\n size: 32,\n signed,\n }),\n };\n}\nfunction encodeString(value) {\n const hexValue = stringToHex(value);\n const partsLength = Math.ceil(size(hexValue) / 32);\n const parts = [];\n for (let i = 0; i < partsLength; i++) {\n parts.push(padHex(slice(hexValue, i * 32, (i + 1) * 32), {\n dir: 'right',\n }));\n }\n return {\n dynamic: true,\n encoded: concat([\n padHex(numberToHex(size(hexValue), { size: 32 })),\n ...parts,\n ]),\n };\n}\nfunction encodeTuple(value, { param }) {\n let dynamic = false;\n const preparedParams = [];\n for (let i = 0; i < param.components.length; i++) {\n const param_ = param.components[i];\n const index = Array.isArray(value) ? i : param_.name;\n const preparedParam = prepareParam({\n param: param_,\n value: value[index],\n });\n preparedParams.push(preparedParam);\n if (preparedParam.dynamic)\n dynamic = true;\n }\n return {\n dynamic,\n encoded: dynamic\n ? encodeParams(preparedParams)\n : concat(preparedParams.map(({ encoded }) => encoded)),\n };\n}\nexport function getArrayComponents(type) {\n const matches = type.match(/^(.*)\\[(\\d+)?\\]$/);\n return matches\n ? // Return `null` if the array is dynamic.\n [matches[2] ? Number(matches[2]) : null, matches[1]]\n : undefined;\n}\n//# sourceMappingURL=encodeAbiParameters.js.map","import { AbiDecodingDataSizeTooSmallError, AbiDecodingZeroDataError, InvalidAbiDecodingTypeError, } from '../../errors/abi.js';\nimport { checksumAddress, } from '../address/getAddress.js';\nimport { createCursor, } from '../cursor.js';\nimport { size } from '../data/size.js';\nimport { sliceBytes } from '../data/slice.js';\nimport { trim } from '../data/trim.js';\nimport { bytesToBigInt, bytesToBool, bytesToNumber, bytesToString, } from '../encoding/fromBytes.js';\nimport { hexToBytes } from '../encoding/toBytes.js';\nimport { bytesToHex } from '../encoding/toHex.js';\nimport { getArrayComponents } from './encodeAbiParameters.js';\nexport function decodeAbiParameters(params, data) {\n const bytes = typeof data === 'string' ? hexToBytes(data) : data;\n const cursor = createCursor(bytes);\n if (size(bytes) === 0 && params.length > 0)\n throw new AbiDecodingZeroDataError();\n if (size(data) && size(data) < 32)\n throw new AbiDecodingDataSizeTooSmallError({\n data: typeof data === 'string' ? data : bytesToHex(data),\n params: params,\n size: size(data),\n });\n let consumed = 0;\n const values = [];\n for (let i = 0; i < params.length; ++i) {\n const param = params[i];\n cursor.setPosition(consumed);\n const [data, consumed_] = decodeParameter(cursor, param, {\n staticPosition: 0,\n });\n consumed += consumed_;\n values.push(data);\n }\n return values;\n}\nfunction decodeParameter(cursor, param, { staticPosition }) {\n const arrayComponents = getArrayComponents(param.type);\n if (arrayComponents) {\n const [length, type] = arrayComponents;\n return decodeArray(cursor, { ...param, type }, { length, staticPosition });\n }\n if (param.type === 'tuple')\n return decodeTuple(cursor, param, { staticPosition });\n if (param.type === 'address')\n return decodeAddress(cursor);\n if (param.type === 'bool')\n return decodeBool(cursor);\n if (param.type.startsWith('bytes'))\n return decodeBytes(cursor, param, { staticPosition });\n if (param.type.startsWith('uint') || param.type.startsWith('int'))\n return decodeNumber(cursor, param);\n if (param.type === 'string')\n return decodeString(cursor, { staticPosition });\n throw new InvalidAbiDecodingTypeError(param.type, {\n docsPath: '/docs/contract/decodeAbiParameters',\n });\n}\n////////////////////////////////////////////////////////////////////\n// Type Decoders\nconst sizeOfLength = 32;\nconst sizeOfOffset = 32;\nfunction decodeAddress(cursor) {\n const value = cursor.readBytes(32);\n return [checksumAddress(bytesToHex(sliceBytes(value, -20))), 32];\n}\nfunction decodeArray(cursor, param, { length, staticPosition }) {\n // If the length of the array is not known in advance (dynamic array),\n // this means we will need to wonder off to the pointer and decode.\n if (!length) {\n // Dealing with a dynamic type, so get the offset of the array data.\n const offset = bytesToNumber(cursor.readBytes(sizeOfOffset));\n // Start is the static position of current slot + offset.\n const start = staticPosition + offset;\n const startOfData = start + sizeOfLength;\n // Get the length of the array from the offset.\n cursor.setPosition(start);\n const length = bytesToNumber(cursor.readBytes(sizeOfLength));\n // Check if the array has any dynamic children.\n const dynamicChild = hasDynamicChild(param);\n let consumed = 0;\n const value = [];\n for (let i = 0; i < length; ++i) {\n // If any of the children is dynamic, then all elements will be offset pointer, thus size of one slot (32 bytes).\n // Otherwise, elements will be the size of their encoding (consumed bytes).\n cursor.setPosition(startOfData + (dynamicChild ? i * 32 : consumed));\n const [data, consumed_] = decodeParameter(cursor, param, {\n staticPosition: startOfData,\n });\n consumed += consumed_;\n value.push(data);\n }\n // As we have gone wondering, restore to the original position + next slot.\n cursor.setPosition(staticPosition + 32);\n return [value, 32];\n }\n // If the length of the array is known in advance,\n // and the length of an element deeply nested in the array is not known,\n // we need to decode the offset of the array data.\n if (hasDynamicChild(param)) {\n // Dealing with dynamic types, so get the offset of the array data.\n const offset = bytesToNumber(cursor.readBytes(sizeOfOffset));\n // Start is the static position of current slot + offset.\n const start = staticPosition + offset;\n const value = [];\n for (let i = 0; i < length; ++i) {\n // Move cursor along to the next slot (next offset pointer).\n cursor.setPosition(start + i * 32);\n const [data] = decodeParameter(cursor, param, {\n staticPosition: start,\n });\n value.push(data);\n }\n // As we have gone wondering, restore to the original position + next slot.\n cursor.setPosition(staticPosition + 32);\n return [value, 32];\n }\n // If the length of the array is known in advance and the array is deeply static,\n // then we can just decode each element in sequence.\n let consumed = 0;\n const value = [];\n for (let i = 0; i < length; ++i) {\n const [data, consumed_] = decodeParameter(cursor, param, {\n staticPosition: staticPosition + consumed,\n });\n consumed += consumed_;\n value.push(data);\n }\n return [value, consumed];\n}\nfunction decodeBool(cursor) {\n return [bytesToBool(cursor.readBytes(32), { size: 32 }), 32];\n}\nfunction decodeBytes(cursor, param, { staticPosition }) {\n const [_, size] = param.type.split('bytes');\n if (!size) {\n // Dealing with dynamic types, so get the offset of the bytes data.\n const offset = bytesToNumber(cursor.readBytes(32));\n // Set position of the cursor to start of bytes data.\n cursor.setPosition(staticPosition + offset);\n const length = bytesToNumber(cursor.readBytes(32));\n // If there is no length, we have zero data.\n if (length === 0) {\n // As we have gone wondering, restore to the original position + next slot.\n cursor.setPosition(staticPosition + 32);\n return ['0x', 32];\n }\n const data = cursor.readBytes(length);\n // As we have gone wondering, restore to the original position + next slot.\n cursor.setPosition(staticPosition + 32);\n return [bytesToHex(data), 32];\n }\n const value = bytesToHex(cursor.readBytes(Number.parseInt(size), 32));\n return [value, 32];\n}\nfunction decodeNumber(cursor, param) {\n const signed = param.type.startsWith('int');\n const size = Number.parseInt(param.type.split('int')[1] || '256');\n const value = cursor.readBytes(32);\n return [\n size > 48\n ? bytesToBigInt(value, { signed })\n : bytesToNumber(value, { signed }),\n 32,\n ];\n}\nfunction decodeTuple(cursor, param, { staticPosition }) {\n // Tuples can have unnamed components (i.e. they are arrays), so we must\n // determine whether the tuple is named or unnamed. In the case of a named\n // tuple, the value will be an object where each property is the name of the\n // component. In the case of an unnamed tuple, the value will be an array.\n const hasUnnamedChild = param.components.length === 0 || param.components.some(({ name }) => !name);\n // Initialize the value to an object or an array, depending on whether the\n // tuple is named or unnamed.\n const value = hasUnnamedChild ? [] : {};\n let consumed = 0;\n // If the tuple has a dynamic child, we must first decode the offset to the\n // tuple data.\n if (hasDynamicChild(param)) {\n // Dealing with dynamic types, so get the offset of the tuple data.\n const offset = bytesToNumber(cursor.readBytes(sizeOfOffset));\n // Start is the static position of referencing slot + offset.\n const start = staticPosition + offset;\n for (let i = 0; i < param.components.length; ++i) {\n const component = param.components[i];\n cursor.setPosition(start + consumed);\n const [data, consumed_] = decodeParameter(cursor, component, {\n staticPosition: start,\n });\n consumed += consumed_;\n value[hasUnnamedChild ? i : component?.name] = data;\n }\n // As we have gone wondering, restore to the original position + next slot.\n cursor.setPosition(staticPosition + 32);\n return [value, 32];\n }\n // If the tuple has static children, we can just decode each component\n // in sequence.\n for (let i = 0; i < param.components.length; ++i) {\n const component = param.components[i];\n const [data, consumed_] = decodeParameter(cursor, component, {\n staticPosition,\n });\n value[hasUnnamedChild ? i : component?.name] = data;\n consumed += consumed_;\n }\n return [value, consumed];\n}\nfunction decodeString(cursor, { staticPosition }) {\n // Get offset to start of string data.\n const offset = bytesToNumber(cursor.readBytes(32));\n // Start is the static position of current slot + offset.\n const start = staticPosition + offset;\n cursor.setPosition(start);\n const length = bytesToNumber(cursor.readBytes(32));\n // If there is no length, we have zero data (empty string).\n if (length === 0) {\n cursor.setPosition(staticPosition + 32);\n return ['', 32];\n }\n const data = cursor.readBytes(length, 32);\n const value = bytesToString(trim(data));\n // As we have gone wondering, restore to the original position + next slot.\n cursor.setPosition(staticPosition + 32);\n return [value, 32];\n}\nfunction hasDynamicChild(param) {\n const { type } = param;\n if (type === 'string')\n return true;\n if (type === 'bytes')\n return true;\n if (type.endsWith('[]'))\n return true;\n if (type === 'tuple')\n return param.components?.some(hasDynamicChild);\n const arrayComponents = getArrayComponents(param.type);\n if (arrayComponents &&\n hasDynamicChild({ ...param, type: arrayComponents[1] }))\n return true;\n return false;\n}\n//# sourceMappingURL=decodeAbiParameters.js.map","import { solidityError, solidityPanic } from '../../constants/solidity.js';\nimport { AbiDecodingZeroDataError, AbiErrorSignatureNotFoundError, } from '../../errors/abi.js';\nimport { slice } from '../data/slice.js';\nimport { toFunctionSelector, } from '../hash/toFunctionSelector.js';\nimport { decodeAbiParameters, } from './decodeAbiParameters.js';\nimport { formatAbiItem } from './formatAbiItem.js';\nexport function decodeErrorResult(parameters) {\n const { abi, data } = parameters;\n const signature = slice(data, 0, 4);\n if (signature === '0x')\n throw new AbiDecodingZeroDataError();\n const abi_ = [...(abi || []), solidityError, solidityPanic];\n const abiItem = abi_.find((x) => x.type === 'error' && signature === toFunctionSelector(formatAbiItem(x)));\n if (!abiItem)\n throw new AbiErrorSignatureNotFoundError(signature, {\n docsPath: '/docs/contract/decodeErrorResult',\n });\n return {\n abiItem,\n args: 'inputs' in abiItem && abiItem.inputs && abiItem.inputs.length > 0\n ? decodeAbiParameters(abiItem.inputs, slice(data, 4))\n : undefined,\n errorName: abiItem.name,\n };\n}\n//# sourceMappingURL=decodeErrorResult.js.map","import { stringify } from '../stringify.js';\nexport function formatAbiItemWithArgs({ abiItem, args, includeFunctionName = true, includeName = false, }) {\n if (!('name' in abiItem))\n return;\n if (!('inputs' in abiItem))\n return;\n if (!abiItem.inputs)\n return;\n return `${includeFunctionName ? abiItem.name : ''}(${abiItem.inputs\n .map((input, i) => `${includeName && input.name ? `${input.name}: ` : ''}${typeof args[i] === 'object' ? stringify(args[i]) : args[i]}`)\n .join(', ')})`;\n}\n//# sourceMappingURL=formatAbiItemWithArgs.js.map","import { toSignatureHash, } from './toSignatureHash.js';\n/**\n * Returns the event selector for a given event definition.\n *\n * @example\n * const selector = toEventSelector('Transfer(address indexed from, address indexed to, uint256 amount)')\n * // 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\n */\nexport const toEventSelector = toSignatureHash;\n//# sourceMappingURL=toEventSelector.js.map","import { AbiItemAmbiguityError, } from '../../errors/abi.js';\nimport { isHex } from '../../utils/data/isHex.js';\nimport { isAddress } from '../address/isAddress.js';\nimport { toEventSelector } from '../hash/toEventSelector.js';\nimport { toFunctionSelector, } from '../hash/toFunctionSelector.js';\nexport function getAbiItem(parameters) {\n const { abi, args = [], name } = parameters;\n const isSelector = isHex(name, { strict: false });\n const abiItems = abi.filter((abiItem) => {\n if (isSelector) {\n if (abiItem.type === 'function')\n return toFunctionSelector(abiItem) === name;\n if (abiItem.type === 'event')\n return toEventSelector(abiItem) === name;\n return false;\n }\n return 'name' in abiItem && abiItem.name === name;\n });\n if (abiItems.length === 0)\n return undefined;\n if (abiItems.length === 1)\n return abiItems[0];\n let matchedAbiItem = undefined;\n for (const abiItem of abiItems) {\n if (!('inputs' in abiItem))\n continue;\n if (!args || args.length === 0) {\n if (!abiItem.inputs || abiItem.inputs.length === 0)\n return abiItem;\n continue;\n }\n if (!abiItem.inputs)\n continue;\n if (abiItem.inputs.length === 0)\n continue;\n if (abiItem.inputs.length !== args.length)\n continue;\n const matched = args.every((arg, index) => {\n const abiParameter = 'inputs' in abiItem && abiItem.inputs[index];\n if (!abiParameter)\n return false;\n return isArgOfType(arg, abiParameter);\n });\n if (matched) {\n // Check for ambiguity against already matched parameters (e.g. `address` vs `bytes20`).\n if (matchedAbiItem &&\n 'inputs' in matchedAbiItem &&\n matchedAbiItem.inputs) {\n const ambiguousTypes = getAmbiguousTypes(abiItem.inputs, matchedAbiItem.inputs, args);\n if (ambiguousTypes)\n throw new AbiItemAmbiguityError({\n abiItem,\n type: ambiguousTypes[0],\n }, {\n abiItem: matchedAbiItem,\n type: ambiguousTypes[1],\n });\n }\n matchedAbiItem = abiItem;\n }\n }\n if (matchedAbiItem)\n return matchedAbiItem;\n return abiItems[0];\n}\n/** @internal */\nexport function isArgOfType(arg, abiParameter) {\n const argType = typeof arg;\n const abiParameterType = abiParameter.type;\n switch (abiParameterType) {\n case 'address':\n return isAddress(arg, { strict: false });\n case 'bool':\n return argType === 'boolean';\n case 'function':\n return argType === 'string';\n case 'string':\n return argType === 'string';\n default: {\n if (abiParameterType === 'tuple' && 'components' in abiParameter)\n return Object.values(abiParameter.components).every((component, index) => {\n return isArgOfType(Object.values(arg)[index], component);\n });\n // `(u)int`: (un)signed integer type of `M` bits, `0 < M <= 256`, `M % 8 == 0`\n // https://regexr.com/6v8hp\n if (/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(abiParameterType))\n return argType === 'number' || argType === 'bigint';\n // `bytes`: binary type of `M` bytes, `0 < M <= 32`\n // https://regexr.com/6va55\n if (/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(abiParameterType))\n return argType === 'string' || arg instanceof Uint8Array;\n // fixed-length (`[M]`) and dynamic (`[]`) arrays\n // https://regexr.com/6va6i\n if (/[a-z]+[1-9]{0,3}(\\[[0-9]{0,}\\])+$/.test(abiParameterType)) {\n return (Array.isArray(arg) &&\n arg.every((x) => isArgOfType(x, {\n ...abiParameter,\n // Pop off `[]` or `[M]` from end of type\n type: abiParameterType.replace(/(\\[[0-9]{0,}\\])$/, ''),\n })));\n }\n return false;\n }\n }\n}\n/** @internal */\nexport function getAmbiguousTypes(sourceParameters, targetParameters, args) {\n for (const parameterIndex in sourceParameters) {\n const sourceParameter = sourceParameters[parameterIndex];\n const targetParameter = targetParameters[parameterIndex];\n if (sourceParameter.type === 'tuple' &&\n targetParameter.type === 'tuple' &&\n 'components' in sourceParameter &&\n 'components' in targetParameter)\n return getAmbiguousTypes(sourceParameter.components, targetParameter.components, args[parameterIndex]);\n const types = [sourceParameter.type, targetParameter.type];\n const ambiguous = (() => {\n if (types.includes('address') && types.includes('bytes20'))\n return true;\n if (types.includes('address') && types.includes('string'))\n return isAddress(args[parameterIndex], { strict: false });\n if (types.includes('address') && types.includes('bytes'))\n return isAddress(args[parameterIndex], { strict: false });\n return false;\n })();\n if (ambiguous)\n return types;\n }\n return;\n}\n//# sourceMappingURL=getAbiItem.js.map","import { parseAccount } from '../accounts/utils/parseAccount.js';\nimport { panicReasons } from '../constants/solidity.js';\nimport { decodeErrorResult, } from '../utils/abi/decodeErrorResult.js';\nimport { formatAbiItem } from '../utils/abi/formatAbiItem.js';\nimport { formatAbiItemWithArgs } from '../utils/abi/formatAbiItemWithArgs.js';\nimport { getAbiItem } from '../utils/abi/getAbiItem.js';\nimport { formatEther } from '../utils/unit/formatEther.js';\nimport { formatGwei } from '../utils/unit/formatGwei.js';\nimport { AbiErrorSignatureNotFoundError } from './abi.js';\nimport { BaseError } from './base.js';\nimport { prettyStateOverride } from './stateOverride.js';\nimport { prettyPrint } from './transaction.js';\nimport { getContractAddress } from './utils.js';\nexport class CallExecutionError extends BaseError {\n constructor(cause, { account: account_, docsPath, chain, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, stateOverride, }) {\n const account = account_ ? parseAccount(account_) : undefined;\n let prettyArgs = prettyPrint({\n from: account?.address,\n to,\n value: typeof value !== 'undefined' &&\n `${formatEther(value)} ${chain?.nativeCurrency?.symbol || 'ETH'}`,\n data,\n gas,\n gasPrice: typeof gasPrice !== 'undefined' && `${formatGwei(gasPrice)} gwei`,\n maxFeePerGas: typeof maxFeePerGas !== 'undefined' &&\n `${formatGwei(maxFeePerGas)} gwei`,\n maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== 'undefined' &&\n `${formatGwei(maxPriorityFeePerGas)} gwei`,\n nonce,\n });\n if (stateOverride) {\n prettyArgs += `\\n${prettyStateOverride(stateOverride)}`;\n }\n super(cause.shortMessage, {\n cause,\n docsPath,\n metaMessages: [\n ...(cause.metaMessages ? [...cause.metaMessages, ' '] : []),\n 'Raw Call Arguments:',\n prettyArgs,\n ].filter(Boolean),\n name: 'CallExecutionError',\n });\n Object.defineProperty(this, \"cause\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.cause = cause;\n }\n}\nexport class ContractFunctionExecutionError extends BaseError {\n constructor(cause, { abi, args, contractAddress, docsPath, functionName, sender, }) {\n const abiItem = getAbiItem({ abi, args, name: functionName });\n const formattedArgs = abiItem\n ? formatAbiItemWithArgs({\n abiItem,\n args,\n includeFunctionName: false,\n includeName: false,\n })\n : undefined;\n const functionWithParams = abiItem\n ? formatAbiItem(abiItem, { includeName: true })\n : undefined;\n const prettyArgs = prettyPrint({\n address: contractAddress && getContractAddress(contractAddress),\n function: functionWithParams,\n args: formattedArgs &&\n formattedArgs !== '()' &&\n `${[...Array(functionName?.length ?? 0).keys()]\n .map(() => ' ')\n .join('')}${formattedArgs}`,\n sender,\n });\n super(cause.shortMessage ||\n `An unknown error occurred while executing the contract function \"${functionName}\".`, {\n cause,\n docsPath,\n metaMessages: [\n ...(cause.metaMessages ? [...cause.metaMessages, ' '] : []),\n prettyArgs && 'Contract Call:',\n prettyArgs,\n ].filter(Boolean),\n name: 'ContractFunctionExecutionError',\n });\n Object.defineProperty(this, \"abi\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"args\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"cause\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"contractAddress\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"formattedArgs\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"functionName\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"sender\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.abi = abi;\n this.args = args;\n this.cause = cause;\n this.contractAddress = contractAddress;\n this.functionName = functionName;\n this.sender = sender;\n }\n}\nexport class ContractFunctionRevertedError extends BaseError {\n constructor({ abi, data, functionName, message, }) {\n let cause;\n let decodedData = undefined;\n let metaMessages;\n let reason;\n if (data && data !== '0x') {\n try {\n decodedData = decodeErrorResult({ abi, data });\n const { abiItem, errorName, args: errorArgs } = decodedData;\n if (errorName === 'Error') {\n reason = errorArgs[0];\n }\n else if (errorName === 'Panic') {\n const [firstArg] = errorArgs;\n reason = panicReasons[firstArg];\n }\n else {\n const errorWithParams = abiItem\n ? formatAbiItem(abiItem, { includeName: true })\n : undefined;\n const formattedArgs = abiItem && errorArgs\n ? formatAbiItemWithArgs({\n abiItem,\n args: errorArgs,\n includeFunctionName: false,\n includeName: false,\n })\n : undefined;\n metaMessages = [\n errorWithParams ? `Error: ${errorWithParams}` : '',\n formattedArgs && formattedArgs !== '()'\n ? ` ${[...Array(errorName?.length ?? 0).keys()]\n .map(() => ' ')\n .join('')}${formattedArgs}`\n : '',\n ];\n }\n }\n catch (err) {\n cause = err;\n }\n }\n else if (message)\n reason = message;\n let signature;\n if (cause instanceof AbiErrorSignatureNotFoundError) {\n signature = cause.signature;\n metaMessages = [\n `Unable to decode signature \"${signature}\" as it was not found on the provided ABI.`,\n 'Make sure you are using the correct ABI and that the error exists on it.',\n `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${signature}.`,\n ];\n }\n super((reason && reason !== 'execution reverted') || signature\n ? [\n `The contract function \"${functionName}\" reverted with the following ${signature ? 'signature' : 'reason'}:`,\n reason || signature,\n ].join('\\n')\n : `The contract function \"${functionName}\" reverted.`, {\n cause,\n metaMessages,\n name: 'ContractFunctionRevertedError',\n });\n Object.defineProperty(this, \"data\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"reason\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"signature\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.data = decodedData;\n this.reason = reason;\n this.signature = signature;\n }\n}\nexport class ContractFunctionZeroDataError extends BaseError {\n constructor({ functionName }) {\n super(`The contract function \"${functionName}\" returned no data (\"0x\").`, {\n metaMessages: [\n 'This could be due to any of the following:',\n ` - The contract does not have the function \"${functionName}\",`,\n ' - The parameters passed to the contract function may be invalid, or',\n ' - The address is not a contract.',\n ],\n name: 'ContractFunctionZeroDataError',\n });\n }\n}\nexport class CounterfactualDeploymentFailedError extends BaseError {\n constructor({ factory }) {\n super(`Deployment for counterfactual contract call failed${factory ? ` for factory \"${factory}\".` : ''}`, {\n metaMessages: [\n 'Please ensure:',\n '- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).',\n '- The `factoryData` is a valid encoded function call for contract deployment function on the factory.',\n ],\n name: 'CounterfactualDeploymentFailedError',\n });\n }\n}\nexport class RawContractError extends BaseError {\n constructor({ data, message, }) {\n super(message || '', { name: 'RawContractError' });\n Object.defineProperty(this, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 3\n });\n Object.defineProperty(this, \"data\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.data = data;\n }\n}\n//# sourceMappingURL=contract.js.map","import { CallExecutionError, } from '../../errors/contract.js';\nimport { UnknownNodeError } from '../../errors/node.js';\nimport { getNodeError, } from './getNodeError.js';\nexport function getCallError(err, { docsPath, ...args }) {\n const cause = (() => {\n const cause = getNodeError(err, args);\n if (cause instanceof UnknownNodeError)\n return err;\n return cause;\n })();\n return new CallExecutionError(cause, {\n docsPath,\n ...args,\n });\n}\n//# sourceMappingURL=getCallError.js.map","import { AbiConstructorNotFoundError, AbiConstructorParamsNotFoundError, } from '../../errors/abi.js';\nimport { concatHex } from '../data/concat.js';\nimport { encodeAbiParameters, } from './encodeAbiParameters.js';\nconst docsPath = '/docs/contract/encodeDeployData';\nexport function encodeDeployData(parameters) {\n const { abi, args, bytecode } = parameters;\n if (!args || args.length === 0)\n return bytecode;\n const description = abi.find((x) => 'type' in x && x.type === 'constructor');\n if (!description)\n throw new AbiConstructorNotFoundError({ docsPath });\n if (!('inputs' in description))\n throw new AbiConstructorParamsNotFoundError({ docsPath });\n if (!description.inputs || description.inputs.length === 0)\n throw new AbiConstructorParamsNotFoundError({ docsPath });\n const data = encodeAbiParameters(description.inputs, args);\n return concatHex([bytecode, data]);\n}\n//# sourceMappingURL=encodeDeployData.js.map","import { UnknownNodeError } from '../../errors/node.js';\nimport { TransactionExecutionError, } from '../../errors/transaction.js';\nimport { getNodeError, } from './getNodeError.js';\nexport function getTransactionError(err, { docsPath, ...args }) {\n const cause = (() => {\n const cause = getNodeError(err, args);\n if (cause instanceof UnknownNodeError)\n return err;\n return cause;\n })();\n return new TransactionExecutionError(cause, {\n docsPath,\n ...args,\n });\n}\n//# sourceMappingURL=getTransactionError.js.map","/**\n * Sends a **signed** transaction to the network\n *\n * - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction\n * - JSON-RPC Method: [`eth_sendRawTransaction`](https://ethereum.github.io/execution-apis/api-documentation/)\n *\n * @param client - Client to use\n * @param parameters - {@link SendRawTransactionParameters}\n * @returns The transaction hash. {@link SendRawTransactionReturnType}\n *\n * @example\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { sendRawTransaction } from 'viem/wallet'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n *\n * const hash = await sendRawTransaction(client, {\n * serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33'\n * })\n */\nexport async function sendRawTransaction(client, { serializedTransaction }) {\n return client.request({\n method: 'eth_sendRawTransaction',\n params: [serializedTransaction],\n }, { retryCount: 0 });\n}\n//# sourceMappingURL=sendRawTransaction.js.map","import { parseAccount, } from '../../accounts/utils/parseAccount.js';\nimport { AccountNotFoundError, AccountTypeNotSupportedError, } from '../../errors/account.js';\nimport { BaseError } from '../../errors/base.js';\nimport { recoverAuthorizationAddress, } from '../../experimental/eip7702/utils/recoverAuthorizationAddress.js';\nimport { assertCurrentChain, } from '../../utils/chain/assertCurrentChain.js';\nimport { getTransactionError, } from '../../utils/errors/getTransactionError.js';\nimport { extract } from '../../utils/formatters/extract.js';\nimport { formatTransactionRequest, } from '../../utils/formatters/transactionRequest.js';\nimport { getAction } from '../../utils/getAction.js';\nimport { LruMap } from '../../utils/lru.js';\nimport { assertRequest, } from '../../utils/transaction/assertRequest.js';\nimport { getChainId } from '../public/getChainId.js';\nimport { defaultParameters, prepareTransactionRequest, } from './prepareTransactionRequest.js';\nimport { sendRawTransaction, } from './sendRawTransaction.js';\nconst supportsWalletNamespace = new LruMap(128);\n/**\n * Creates, signs, and sends a new transaction to the network.\n *\n * - Docs: https://viem.sh/docs/actions/wallet/sendTransaction\n * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/sending-transactions\n * - JSON-RPC Methods:\n * - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)\n * - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)\n *\n * @param client - Client to use\n * @param parameters - {@link SendTransactionParameters}\n * @returns The [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. {@link SendTransactionReturnType}\n *\n * @example\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { sendTransaction } from 'viem/wallet'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n * const hash = await sendTransaction(client, {\n * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',\n * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',\n * value: 1000000000000000000n,\n * })\n *\n * @example\n * // Account Hoisting\n * import { createWalletClient, http } from 'viem'\n * import { privateKeyToAccount } from 'viem/accounts'\n * import { mainnet } from 'viem/chains'\n * import { sendTransaction } from 'viem/wallet'\n *\n * const client = createWalletClient({\n * account: privateKeyToAccount('0x…'),\n * chain: mainnet,\n * transport: http(),\n * })\n * const hash = await sendTransaction(client, {\n * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',\n * value: 1000000000000000000n,\n * })\n */\nexport async function sendTransaction(client, parameters) {\n const { account: account_ = client.account, chain = client.chain, accessList, authorizationList, blobs, data, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, value, ...rest } = parameters;\n if (typeof account_ === 'undefined')\n throw new AccountNotFoundError({\n docsPath: '/docs/actions/wallet/sendTransaction',\n });\n const account = account_ ? parseAccount(account_) : null;\n try {\n assertRequest(parameters);\n const to = await (async () => {\n // If `to` exists on the parameters, use that.\n if (parameters.to)\n return parameters.to;\n // If no `to` exists, and we are sending a EIP-7702 transaction, use the\n // address of the first authorization in the list.\n if (authorizationList && authorizationList.length > 0)\n return await recoverAuthorizationAddress({\n authorization: authorizationList[0],\n }).catch(() => {\n throw new BaseError('`to` is required. Could not infer from `authorizationList`.');\n });\n // Otherwise, we are sending a deployment transaction.\n return undefined;\n })();\n if (account?.type === 'json-rpc' || account === null) {\n let chainId;\n if (chain !== null) {\n chainId = await getAction(client, getChainId, 'getChainId')({});\n assertCurrentChain({\n currentChainId: chainId,\n chain,\n });\n }\n const chainFormat = client.chain?.formatters?.transactionRequest?.format;\n const format = chainFormat || formatTransactionRequest;\n const request = format({\n // Pick out extra data that might exist on the chain's transaction request type.\n ...extract(rest, { format: chainFormat }),\n accessList,\n authorizationList,\n blobs,\n chainId,\n data,\n from: account?.address,\n gas,\n gasPrice,\n maxFeePerBlobGas,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value,\n });\n const method = supportsWalletNamespace.get(client.uid)\n ? 'wallet_sendTransaction'\n : 'eth_sendTransaction';\n try {\n return await client.request({\n method,\n params: [request],\n }, { retryCount: 0 });\n }\n catch (e) {\n const error = e;\n // If the transport does not support the method or input, attempt to use the\n // `wallet_sendTransaction` method.\n if (error.name === 'InvalidInputRpcError' ||\n error.name === 'InvalidParamsRpcError' ||\n error.name === 'MethodNotFoundRpcError' ||\n error.name === 'MethodNotSupportedRpcError')\n return await client\n .request({\n method: 'wallet_sendTransaction',\n params: [request],\n }, { retryCount: 0 })\n .then((hash) => {\n supportsWalletNamespace.set(client.uid, true);\n return hash;\n });\n throw error;\n }\n }\n if (account?.type === 'local') {\n // Prepare the request for signing (assign appropriate fees, etc.)\n const request = await getAction(client, prepareTransactionRequest, 'prepareTransactionRequest')({\n account,\n accessList,\n authorizationList,\n blobs,\n chain,\n data,\n gas,\n gasPrice,\n maxFeePerBlobGas,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n nonceManager: account.nonceManager,\n parameters: [...defaultParameters, 'sidecars'],\n value,\n ...rest,\n to,\n });\n const serializer = chain?.serializers?.transaction;\n const serializedTransaction = (await account.signTransaction(request, {\n serializer,\n }));\n return await getAction(client, sendRawTransaction, 'sendRawTransaction')({\n serializedTransaction,\n });\n }\n if (account?.type === 'smart')\n throw new AccountTypeNotSupportedError({\n metaMessages: [\n 'Consider using the `sendUserOperation` Action instead.',\n ],\n docsPath: '/docs/actions/bundler/sendUserOperation',\n type: 'smart',\n });\n throw new AccountTypeNotSupportedError({\n docsPath: '/docs/actions/wallet/sendTransaction',\n type: account?.type,\n });\n }\n catch (err) {\n if (err instanceof AccountTypeNotSupportedError)\n throw err;\n throw getTransactionError(err, {\n ...parameters,\n account,\n chain: parameters.chain || undefined,\n });\n }\n}\n//# sourceMappingURL=sendTransaction.js.map","/* [Multicall3](https://github.com/mds1/multicall) */\nexport const multicall3Abi = [\n {\n inputs: [\n {\n components: [\n {\n name: 'target',\n type: 'address',\n },\n {\n name: 'allowFailure',\n type: 'bool',\n },\n {\n name: 'callData',\n type: 'bytes',\n },\n ],\n name: 'calls',\n type: 'tuple[]',\n },\n ],\n name: 'aggregate3',\n outputs: [\n {\n components: [\n {\n name: 'success',\n type: 'bool',\n },\n {\n name: 'returnData',\n type: 'bytes',\n },\n ],\n name: 'returnData',\n type: 'tuple[]',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n];\nconst universalResolverErrors = [\n {\n inputs: [],\n name: 'ResolverNotFound',\n type: 'error',\n },\n {\n inputs: [],\n name: 'ResolverWildcardNotSupported',\n type: 'error',\n },\n {\n inputs: [],\n name: 'ResolverNotContract',\n type: 'error',\n },\n {\n inputs: [\n {\n name: 'returnData',\n type: 'bytes',\n },\n ],\n name: 'ResolverError',\n type: 'error',\n },\n {\n inputs: [\n {\n components: [\n {\n name: 'status',\n type: 'uint16',\n },\n {\n name: 'message',\n type: 'string',\n },\n ],\n name: 'errors',\n type: 'tuple[]',\n },\n ],\n name: 'HttpError',\n type: 'error',\n },\n];\nexport const universalResolverResolveAbi = [\n ...universalResolverErrors,\n {\n name: 'resolve',\n type: 'function',\n stateMutability: 'view',\n inputs: [\n { name: 'name', type: 'bytes' },\n { name: 'data', type: 'bytes' },\n ],\n outputs: [\n { name: '', type: 'bytes' },\n { name: 'address', type: 'address' },\n ],\n },\n {\n name: 'resolve',\n type: 'function',\n stateMutability: 'view',\n inputs: [\n { name: 'name', type: 'bytes' },\n { name: 'data', type: 'bytes' },\n { name: 'gateways', type: 'string[]' },\n ],\n outputs: [\n { name: '', type: 'bytes' },\n { name: 'address', type: 'address' },\n ],\n },\n];\nexport const universalResolverReverseAbi = [\n ...universalResolverErrors,\n {\n name: 'reverse',\n type: 'function',\n stateMutability: 'view',\n inputs: [{ type: 'bytes', name: 'reverseName' }],\n outputs: [\n { type: 'string', name: 'resolvedName' },\n { type: 'address', name: 'resolvedAddress' },\n { type: 'address', name: 'reverseResolver' },\n { type: 'address', name: 'resolver' },\n ],\n },\n {\n name: 'reverse',\n type: 'function',\n stateMutability: 'view',\n inputs: [\n { type: 'bytes', name: 'reverseName' },\n { type: 'string[]', name: 'gateways' },\n ],\n outputs: [\n { type: 'string', name: 'resolvedName' },\n { type: 'address', name: 'resolvedAddress' },\n { type: 'address', name: 'reverseResolver' },\n { type: 'address', name: 'resolver' },\n ],\n },\n];\nexport const textResolverAbi = [\n {\n name: 'text',\n type: 'function',\n stateMutability: 'view',\n inputs: [\n { name: 'name', type: 'bytes32' },\n { name: 'key', type: 'string' },\n ],\n outputs: [{ name: '', type: 'string' }],\n },\n];\nexport const addressResolverAbi = [\n {\n name: 'addr',\n type: 'function',\n stateMutability: 'view',\n inputs: [{ name: 'name', type: 'bytes32' }],\n outputs: [{ name: '', type: 'address' }],\n },\n {\n name: 'addr',\n type: 'function',\n stateMutability: 'view',\n inputs: [\n { name: 'name', type: 'bytes32' },\n { name: 'coinType', type: 'uint256' },\n ],\n outputs: [{ name: '', type: 'bytes' }],\n },\n];\n// ERC-1271\n// isValidSignature(bytes32 hash, bytes signature) → bytes4 magicValue\n/** @internal */\nexport const smartAccountAbi = [\n {\n name: 'isValidSignature',\n type: 'function',\n stateMutability: 'view',\n inputs: [\n { name: 'hash', type: 'bytes32' },\n { name: 'signature', type: 'bytes' },\n ],\n outputs: [{ name: '', type: 'bytes4' }],\n },\n];\n// ERC-6492 - universal deployless signature validator contract\n// constructor(address _signer, bytes32 _hash, bytes _signature) → bytes4 returnValue\n// returnValue is either 0x1 (valid) or 0x0 (invalid)\nexport const universalSignatureValidatorAbi = [\n {\n inputs: [\n {\n name: '_signer',\n type: 'address',\n },\n {\n name: '_hash',\n type: 'bytes32',\n },\n {\n name: '_signature',\n type: 'bytes',\n },\n ],\n stateMutability: 'nonpayable',\n type: 'constructor',\n },\n {\n inputs: [\n {\n name: '_signer',\n type: 'address',\n },\n {\n name: '_hash',\n type: 'bytes32',\n },\n {\n name: '_signature',\n type: 'bytes',\n },\n ],\n outputs: [\n {\n type: 'bool',\n },\n ],\n stateMutability: 'nonpayable',\n type: 'function',\n name: 'isValidSig',\n },\n];\n/** [ERC-20 Token Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-20) */\nexport const erc20Abi = [\n {\n type: 'event',\n name: 'Approval',\n inputs: [\n {\n indexed: true,\n name: 'owner',\n type: 'address',\n },\n {\n indexed: true,\n name: 'spender',\n type: 'address',\n },\n {\n indexed: false,\n name: 'value',\n type: 'uint256',\n },\n ],\n },\n {\n type: 'event',\n name: 'Transfer',\n inputs: [\n {\n indexed: true,\n name: 'from',\n type: 'address',\n },\n {\n indexed: true,\n name: 'to',\n type: 'address',\n },\n {\n indexed: false,\n name: 'value',\n type: 'uint256',\n },\n ],\n },\n {\n type: 'function',\n name: 'allowance',\n stateMutability: 'view',\n inputs: [\n {\n name: 'owner',\n type: 'address',\n },\n {\n name: 'spender',\n type: 'address',\n },\n ],\n outputs: [\n {\n type: 'uint256',\n },\n ],\n },\n {\n type: 'function',\n name: 'approve',\n stateMutability: 'nonpayable',\n inputs: [\n {\n name: 'spender',\n type: 'address',\n },\n {\n name: 'amount',\n type: 'uint256',\n },\n ],\n outputs: [\n {\n type: 'bool',\n },\n ],\n },\n {\n type: 'function',\n name: 'balanceOf',\n stateMutability: 'view',\n inputs: [\n {\n name: 'account',\n type: 'address',\n },\n ],\n outputs: [\n {\n type: 'uint256',\n },\n ],\n },\n {\n type: 'function',\n name: 'decimals',\n stateMutability: 'view',\n inputs: [],\n outputs: [\n {\n type: 'uint8',\n },\n ],\n },\n {\n type: 'function',\n name: 'name',\n stateMutability: 'view',\n inputs: [],\n outputs: [\n {\n type: 'string',\n },\n ],\n },\n {\n type: 'function',\n name: 'symbol',\n stateMutability: 'view',\n inputs: [],\n outputs: [\n {\n type: 'string',\n },\n ],\n },\n {\n type: 'function',\n name: 'totalSupply',\n stateMutability: 'view',\n inputs: [],\n outputs: [\n {\n type: 'uint256',\n },\n ],\n },\n {\n type: 'function',\n name: 'transfer',\n stateMutability: 'nonpayable',\n inputs: [\n {\n name: 'recipient',\n type: 'address',\n },\n {\n name: 'amount',\n type: 'uint256',\n },\n ],\n outputs: [\n {\n type: 'bool',\n },\n ],\n },\n {\n type: 'function',\n name: 'transferFrom',\n stateMutability: 'nonpayable',\n inputs: [\n {\n name: 'sender',\n type: 'address',\n },\n {\n name: 'recipient',\n type: 'address',\n },\n {\n name: 'amount',\n type: 'uint256',\n },\n ],\n outputs: [\n {\n type: 'bool',\n },\n ],\n },\n];\n/**\n * [bytes32-flavored ERC-20](https://docs.makerdao.com/smart-contract-modules/mkr-module#4.-gotchas-potential-source-of-user-error)\n * for tokens (ie. Maker) that use bytes32 instead of string.\n */\nexport const erc20Abi_bytes32 = [\n {\n type: 'event',\n name: 'Approval',\n inputs: [\n {\n indexed: true,\n name: 'owner',\n type: 'address',\n },\n {\n indexed: true,\n name: 'spender',\n type: 'address',\n },\n {\n indexed: false,\n name: 'value',\n type: 'uint256',\n },\n ],\n },\n {\n type: 'event',\n name: 'Transfer',\n inputs: [\n {\n indexed: true,\n name: 'from',\n type: 'address',\n },\n {\n indexed: true,\n name: 'to',\n type: 'address',\n },\n {\n indexed: false,\n name: 'value',\n type: 'uint256',\n },\n ],\n },\n {\n type: 'function',\n name: 'allowance',\n stateMutability: 'view',\n inputs: [\n {\n name: 'owner',\n type: 'address',\n },\n {\n name: 'spender',\n type: 'address',\n },\n ],\n outputs: [\n {\n type: 'uint256',\n },\n ],\n },\n {\n type: 'function',\n name: 'approve',\n stateMutability: 'nonpayable',\n inputs: [\n {\n name: 'spender',\n type: 'address',\n },\n {\n name: 'amount',\n type: 'uint256',\n },\n ],\n outputs: [\n {\n type: 'bool',\n },\n ],\n },\n {\n type: 'function',\n name: 'balanceOf',\n stateMutability: 'view',\n inputs: [\n {\n name: 'account',\n type: 'address',\n },\n ],\n outputs: [\n {\n type: 'uint256',\n },\n ],\n },\n {\n type: 'function',\n name: 'decimals',\n stateMutability: 'view',\n inputs: [],\n outputs: [\n {\n type: 'uint8',\n },\n ],\n },\n {\n type: 'function',\n name: 'name',\n stateMutability: 'view',\n inputs: [],\n outputs: [\n {\n type: 'bytes32',\n },\n ],\n },\n {\n type: 'function',\n name: 'symbol',\n stateMutability: 'view',\n inputs: [],\n outputs: [\n {\n type: 'bytes32',\n },\n ],\n },\n {\n type: 'function',\n name: 'totalSupply',\n stateMutability: 'view',\n inputs: [],\n outputs: [\n {\n type: 'uint256',\n },\n ],\n },\n {\n type: 'function',\n name: 'transfer',\n stateMutability: 'nonpayable',\n inputs: [\n {\n name: 'recipient',\n type: 'address',\n },\n {\n name: 'amount',\n type: 'uint256',\n },\n ],\n outputs: [\n {\n type: 'bool',\n },\n ],\n },\n {\n type: 'function',\n name: 'transferFrom',\n stateMutability: 'nonpayable',\n inputs: [\n {\n name: 'sender',\n type: 'address',\n },\n {\n name: 'recipient',\n type: 'address',\n },\n {\n name: 'amount',\n type: 'uint256',\n },\n ],\n outputs: [\n {\n type: 'bool',\n },\n ],\n },\n];\n/** [ERC-721 Non-Fungible Token Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-721) */\nexport const erc721Abi = [\n {\n type: 'event',\n name: 'Approval',\n inputs: [\n {\n indexed: true,\n name: 'owner',\n type: 'address',\n },\n {\n indexed: true,\n name: 'spender',\n type: 'address',\n },\n {\n indexed: true,\n name: 'tokenId',\n type: 'uint256',\n },\n ],\n },\n {\n type: 'event',\n name: 'ApprovalForAll',\n inputs: [\n {\n indexed: true,\n name: 'owner',\n type: 'address',\n },\n {\n indexed: true,\n name: 'operator',\n type: 'address',\n },\n {\n indexed: false,\n name: 'approved',\n type: 'bool',\n },\n ],\n },\n {\n type: 'event',\n name: 'Transfer',\n inputs: [\n {\n indexed: true,\n name: 'from',\n type: 'address',\n },\n {\n indexed: true,\n name: 'to',\n type: 'address',\n },\n {\n indexed: true,\n name: 'tokenId',\n type: 'uint256',\n },\n ],\n },\n {\n type: 'function',\n name: 'approve',\n stateMutability: 'payable',\n inputs: [\n {\n name: 'spender',\n type: 'address',\n },\n {\n name: 'tokenId',\n type: 'uint256',\n },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'balanceOf',\n stateMutability: 'view',\n inputs: [\n {\n name: 'account',\n type: 'address',\n },\n ],\n outputs: [\n {\n type: 'uint256',\n },\n ],\n },\n {\n type: 'function',\n name: 'getApproved',\n stateMutability: 'view',\n inputs: [\n {\n name: 'tokenId',\n type: 'uint256',\n },\n ],\n outputs: [\n {\n type: 'address',\n },\n ],\n },\n {\n type: 'function',\n name: 'isApprovedForAll',\n stateMutability: 'view',\n inputs: [\n {\n name: 'owner',\n type: 'address',\n },\n {\n name: 'operator',\n type: 'address',\n },\n ],\n outputs: [\n {\n type: 'bool',\n },\n ],\n },\n {\n type: 'function',\n name: 'name',\n stateMutability: 'view',\n inputs: [],\n outputs: [\n {\n type: 'string',\n },\n ],\n },\n {\n type: 'function',\n name: 'ownerOf',\n stateMutability: 'view',\n inputs: [\n {\n name: 'tokenId',\n type: 'uint256',\n },\n ],\n outputs: [\n {\n name: 'owner',\n type: 'address',\n },\n ],\n },\n {\n type: 'function',\n name: 'safeTransferFrom',\n stateMutability: 'payable',\n inputs: [\n {\n name: 'from',\n type: 'address',\n },\n {\n name: 'to',\n type: 'address',\n },\n {\n name: 'tokenId',\n type: 'uint256',\n },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'safeTransferFrom',\n stateMutability: 'nonpayable',\n inputs: [\n {\n name: 'from',\n type: 'address',\n },\n {\n name: 'to',\n type: 'address',\n },\n {\n name: 'id',\n type: 'uint256',\n },\n {\n name: 'data',\n type: 'bytes',\n },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'setApprovalForAll',\n stateMutability: 'nonpayable',\n inputs: [\n {\n name: 'operator',\n type: 'address',\n },\n {\n name: 'approved',\n type: 'bool',\n },\n ],\n outputs: [],\n },\n {\n type: 'function',\n name: 'symbol',\n stateMutability: 'view',\n inputs: [],\n outputs: [\n {\n type: 'string',\n },\n ],\n },\n {\n type: 'function',\n name: 'tokenByIndex',\n stateMutability: 'view',\n inputs: [\n {\n name: 'index',\n type: 'uint256',\n },\n ],\n outputs: [\n {\n type: 'uint256',\n },\n ],\n },\n {\n type: 'function',\n name: 'tokenByIndex',\n stateMutability: 'view',\n inputs: [\n {\n name: 'owner',\n type: 'address',\n },\n {\n name: 'index',\n type: 'uint256',\n },\n ],\n outputs: [\n {\n name: 'tokenId',\n type: 'uint256',\n },\n ],\n },\n {\n type: 'function',\n name: 'tokenURI',\n stateMutability: 'view',\n inputs: [\n {\n name: 'tokenId',\n type: 'uint256',\n },\n ],\n outputs: [\n {\n type: 'string',\n },\n ],\n },\n {\n type: 'function',\n name: 'totalSupply',\n stateMutability: 'view',\n inputs: [],\n outputs: [\n {\n type: 'uint256',\n },\n ],\n },\n {\n type: 'function',\n name: 'transferFrom',\n stateMutability: 'payable',\n inputs: [\n {\n name: 'sender',\n type: 'address',\n },\n {\n name: 'recipient',\n type: 'address',\n },\n {\n name: 'tokeId',\n type: 'uint256',\n },\n ],\n outputs: [],\n },\n];\n/** [ERC-4626 Tokenized Vaults Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-4626) */\nexport const erc4626Abi = [\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n name: 'owner',\n type: 'address',\n },\n {\n indexed: true,\n name: 'spender',\n type: 'address',\n },\n {\n indexed: false,\n name: 'value',\n type: 'uint256',\n },\n ],\n name: 'Approval',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n name: 'sender',\n type: 'address',\n },\n {\n indexed: true,\n name: 'receiver',\n type: 'address',\n },\n {\n indexed: false,\n name: 'assets',\n type: 'uint256',\n },\n {\n indexed: false,\n name: 'shares',\n type: 'uint256',\n },\n ],\n name: 'Deposit',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n name: 'from',\n type: 'address',\n },\n {\n indexed: true,\n name: 'to',\n type: 'address',\n },\n {\n indexed: false,\n name: 'value',\n type: 'uint256',\n },\n ],\n name: 'Transfer',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n name: 'sender',\n type: 'address',\n },\n {\n indexed: true,\n name: 'receiver',\n type: 'address',\n },\n {\n indexed: true,\n name: 'owner',\n type: 'address',\n },\n {\n indexed: false,\n name: 'assets',\n type: 'uint256',\n },\n {\n indexed: false,\n name: 'shares',\n type: 'uint256',\n },\n ],\n name: 'Withdraw',\n type: 'event',\n },\n {\n inputs: [\n {\n name: 'owner',\n type: 'address',\n },\n {\n name: 'spender',\n type: 'address',\n },\n ],\n name: 'allowance',\n outputs: [\n {\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'spender',\n type: 'address',\n },\n {\n name: 'amount',\n type: 'uint256',\n },\n ],\n name: 'approve',\n outputs: [\n {\n type: 'bool',\n },\n ],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [],\n name: 'asset',\n outputs: [\n {\n name: 'assetTokenAddress',\n type: 'address',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'account',\n type: 'address',\n },\n ],\n name: 'balanceOf',\n outputs: [\n {\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'shares',\n type: 'uint256',\n },\n ],\n name: 'convertToAssets',\n outputs: [\n {\n name: 'assets',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'assets',\n type: 'uint256',\n },\n ],\n name: 'convertToShares',\n outputs: [\n {\n name: 'shares',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'assets',\n type: 'uint256',\n },\n {\n name: 'receiver',\n type: 'address',\n },\n ],\n name: 'deposit',\n outputs: [\n {\n name: 'shares',\n type: 'uint256',\n },\n ],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'caller',\n type: 'address',\n },\n ],\n name: 'maxDeposit',\n outputs: [\n {\n name: 'maxAssets',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'caller',\n type: 'address',\n },\n ],\n name: 'maxMint',\n outputs: [\n {\n name: 'maxShares',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'owner',\n type: 'address',\n },\n ],\n name: 'maxRedeem',\n outputs: [\n {\n name: 'maxShares',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'owner',\n type: 'address',\n },\n ],\n name: 'maxWithdraw',\n outputs: [\n {\n name: 'maxAssets',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'shares',\n type: 'uint256',\n },\n {\n name: 'receiver',\n type: 'address',\n },\n ],\n name: 'mint',\n outputs: [\n {\n name: 'assets',\n type: 'uint256',\n },\n ],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'assets',\n type: 'uint256',\n },\n ],\n name: 'previewDeposit',\n outputs: [\n {\n name: 'shares',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'shares',\n type: 'uint256',\n },\n ],\n name: 'previewMint',\n outputs: [\n {\n name: 'assets',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'shares',\n type: 'uint256',\n },\n ],\n name: 'previewRedeem',\n outputs: [\n {\n name: 'assets',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'assets',\n type: 'uint256',\n },\n ],\n name: 'previewWithdraw',\n outputs: [\n {\n name: 'shares',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'shares',\n type: 'uint256',\n },\n {\n name: 'receiver',\n type: 'address',\n },\n {\n name: 'owner',\n type: 'address',\n },\n ],\n name: 'redeem',\n outputs: [\n {\n name: 'assets',\n type: 'uint256',\n },\n ],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [],\n name: 'totalAssets',\n outputs: [\n {\n name: 'totalManagedAssets',\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'totalSupply',\n outputs: [\n {\n type: 'uint256',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'to',\n type: 'address',\n },\n {\n name: 'amount',\n type: 'uint256',\n },\n ],\n name: 'transfer',\n outputs: [\n {\n type: 'bool',\n },\n ],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'from',\n type: 'address',\n },\n {\n name: 'to',\n type: 'address',\n },\n {\n name: 'amount',\n type: 'uint256',\n },\n ],\n name: 'transferFrom',\n outputs: [\n {\n type: 'bool',\n },\n ],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [\n {\n name: 'assets',\n type: 'uint256',\n },\n {\n name: 'receiver',\n type: 'address',\n },\n {\n name: 'owner',\n type: 'address',\n },\n ],\n name: 'withdraw',\n outputs: [\n {\n name: 'shares',\n type: 'uint256',\n },\n ],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n];\n//# sourceMappingURL=abis.js.map","import { AbiFunctionNotFoundError, AbiFunctionOutputsNotFoundError, } from '../../errors/abi.js';\nimport { decodeAbiParameters, } from './decodeAbiParameters.js';\nimport { getAbiItem } from './getAbiItem.js';\nconst docsPath = '/docs/contract/decodeFunctionResult';\nexport function decodeFunctionResult(parameters) {\n const { abi, args, functionName, data } = parameters;\n let abiItem = abi[0];\n if (functionName) {\n const item = getAbiItem({ abi, args, name: functionName });\n if (!item)\n throw new AbiFunctionNotFoundError(functionName, { docsPath });\n abiItem = item;\n }\n if (abiItem.type !== 'function')\n throw new AbiFunctionNotFoundError(undefined, { docsPath });\n if (!abiItem.outputs)\n throw new AbiFunctionOutputsNotFoundError(abiItem.name, { docsPath });\n const values = decodeAbiParameters(abiItem.outputs, data);\n if (values && values.length > 1)\n return values;\n if (values && values.length === 1)\n return values[0];\n return undefined;\n}\n//# sourceMappingURL=decodeFunctionResult.js.map","import { AbiFunctionNotFoundError, } from '../../errors/abi.js';\nimport { toFunctionSelector, } from '../hash/toFunctionSelector.js';\nimport { formatAbiItem } from './formatAbiItem.js';\nimport { getAbiItem } from './getAbiItem.js';\nconst docsPath = '/docs/contract/encodeFunctionData';\nexport function prepareEncodeFunctionData(parameters) {\n const { abi, args, functionName } = parameters;\n let abiItem = abi[0];\n if (functionName) {\n const item = getAbiItem({\n abi,\n args,\n name: functionName,\n });\n if (!item)\n throw new AbiFunctionNotFoundError(functionName, { docsPath });\n abiItem = item;\n }\n if (abiItem.type !== 'function')\n throw new AbiFunctionNotFoundError(undefined, { docsPath });\n return {\n abi: [abiItem],\n functionName: toFunctionSelector(formatAbiItem(abiItem)),\n };\n}\n//# sourceMappingURL=prepareEncodeFunctionData.js.map","import { concatHex } from '../data/concat.js';\nimport { encodeAbiParameters, } from './encodeAbiParameters.js';\nimport { prepareEncodeFunctionData } from './prepareEncodeFunctionData.js';\nexport function encodeFunctionData(parameters) {\n const { args } = parameters;\n const { abi, functionName } = (() => {\n if (parameters.abi.length === 1 &&\n parameters.functionName?.startsWith('0x'))\n return parameters;\n return prepareEncodeFunctionData(parameters);\n })();\n const abiItem = abi[0];\n const signature = functionName;\n const data = 'inputs' in abiItem && abiItem.inputs\n ? encodeAbiParameters(abiItem.inputs, args ?? [])\n : undefined;\n return concatHex([signature, data ?? '0x']);\n}\n//# sourceMappingURL=encodeFunctionData.js.map","import { panicReasons } from '../../constants/solidity.js';\nimport { BaseError } from '../../errors/base.js';\nimport { ContractFunctionRevertedError } from '../../errors/contract.js';\n/*\n * @description Checks if error is a valid null result UniversalResolver error\n */\nexport function isNullUniversalResolverError(err, callType) {\n if (!(err instanceof BaseError))\n return false;\n const cause = err.walk((e) => e instanceof ContractFunctionRevertedError);\n if (!(cause instanceof ContractFunctionRevertedError))\n return false;\n if (cause.data?.errorName === 'ResolverNotFound')\n return true;\n if (cause.data?.errorName === 'ResolverWildcardNotSupported')\n return true;\n if (cause.data?.errorName === 'ResolverNotContract')\n return true;\n if (cause.data?.errorName === 'ResolverError')\n return true;\n if (cause.data?.errorName === 'HttpError')\n return true;\n // Backwards compatibility for older UniversalResolver contracts\n if (cause.reason?.includes('Wildcard on non-extended resolvers is not supported'))\n return true;\n // No primary name set for address.\n if (callType === 'reverse' && cause.reason === panicReasons[50])\n return true;\n return false;\n}\n//# sourceMappingURL=errors.js.map","import { isHex } from '../data/isHex.js';\nexport function encodedLabelToLabelhash(label) {\n if (label.length !== 66)\n return null;\n if (label.indexOf('[') !== 0)\n return null;\n if (label.indexOf(']') !== 65)\n return null;\n const hash = `0x${label.slice(1, 65)}`;\n if (!isHex(hash))\n return null;\n return hash;\n}\n//# sourceMappingURL=encodedLabelToLabelhash.js.map","import { concat } from '../data/concat.js';\nimport { stringToBytes, toBytes, } from '../encoding/toBytes.js';\nimport { bytesToHex } from '../encoding/toHex.js';\nimport { keccak256 } from '../hash/keccak256.js';\nimport { encodedLabelToLabelhash, } from './encodedLabelToLabelhash.js';\n/**\n * @description Hashes ENS name\n *\n * - Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `namehash`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this.\n *\n * @example\n * namehash('wevm.eth')\n * '0xf246651c1b9a6b141d19c2604e9a58f567973833990f830d882534a747801359'\n *\n * @link https://eips.ethereum.org/EIPS/eip-137\n */\nexport function namehash(name) {\n let result = new Uint8Array(32).fill(0);\n if (!name)\n return bytesToHex(result);\n const labels = name.split('.');\n // Iterate in reverse order building up hash\n for (let i = labels.length - 1; i >= 0; i -= 1) {\n const hashFromEncodedLabel = encodedLabelToLabelhash(labels[i]);\n const hashed = hashFromEncodedLabel\n ? toBytes(hashFromEncodedLabel)\n : keccak256(stringToBytes(labels[i]), 'bytes');\n result = keccak256(concat([result, hashed]), 'bytes');\n }\n return bytesToHex(result);\n}\n//# sourceMappingURL=namehash.js.map","export function encodeLabelhash(hash) {\n return `[${hash.slice(2)}]`;\n}\n//# sourceMappingURL=encodeLabelhash.js.map","import { stringToBytes, } from '../encoding/toBytes.js';\nimport { bytesToHex } from '../encoding/toHex.js';\nimport { keccak256 } from '../hash/keccak256.js';\nimport { encodedLabelToLabelhash, } from './encodedLabelToLabelhash.js';\n/**\n * @description Hashes ENS label\n *\n * - Since ENS labels prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS labels](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `labelhash`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this.\n *\n * @example\n * labelhash('eth')\n * '0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0'\n */\nexport function labelhash(label) {\n const result = new Uint8Array(32).fill(0);\n if (!label)\n return bytesToHex(result);\n return encodedLabelToLabelhash(label) || keccak256(stringToBytes(label));\n}\n//# sourceMappingURL=labelhash.js.map","import { stringToBytes, } from '../encoding/toBytes.js';\nimport { encodeLabelhash, } from './encodeLabelhash.js';\nimport { labelhash } from './labelhash.js';\n/*\n * @description Encodes a DNS packet into a ByteArray containing a UDP payload.\n *\n * @example\n * packetToBytes('awkweb.eth')\n * '0x0661776b7765620365746800'\n *\n * @see https://docs.ens.domains/resolution/names#dns\n *\n */\nexport function packetToBytes(packet) {\n // strip leading and trailing `.`\n const value = packet.replace(/^\\.|\\.$/gm, '');\n if (value.length === 0)\n return new Uint8Array(1);\n const bytes = new Uint8Array(stringToBytes(value).byteLength + 2);\n let offset = 0;\n const list = value.split('.');\n for (let i = 0; i < list.length; i++) {\n let encoded = stringToBytes(list[i]);\n // if the length is > 255, make the encoded label value a labelhash\n // this is compatible with the universal resolver\n if (encoded.byteLength > 255)\n encoded = stringToBytes(encodeLabelhash(labelhash(list[i])));\n bytes[offset] = encoded.length;\n bytes.set(encoded, offset + 1);\n offset += encoded.length + 1;\n }\n if (bytes.byteLength !== offset + 1)\n return bytes.slice(0, offset + 1);\n return bytes;\n}\n//# sourceMappingURL=packetToBytes.js.map","import { AbiDecodingZeroDataError } from '../../errors/abi.js';\nimport { BaseError } from '../../errors/base.js';\nimport { ContractFunctionExecutionError, ContractFunctionRevertedError, ContractFunctionZeroDataError, RawContractError, } from '../../errors/contract.js';\nimport { InternalRpcError } from '../../errors/rpc.js';\nconst EXECUTION_REVERTED_ERROR_CODE = 3;\nexport function getContractError(err, { abi, address, args, docsPath, functionName, sender, }) {\n const { code, data, message, shortMessage } = (err instanceof RawContractError\n ? err\n : err instanceof BaseError\n ? err.walk((err) => 'data' in err) || err.walk()\n : {});\n const cause = (() => {\n if (err instanceof AbiDecodingZeroDataError)\n return new ContractFunctionZeroDataError({ functionName });\n if ([EXECUTION_REVERTED_ERROR_CODE, InternalRpcError.code].includes(code) &&\n (data || message || shortMessage)) {\n return new ContractFunctionRevertedError({\n abi,\n data: typeof data === 'object' ? data.data : data,\n functionName,\n message: shortMessage ?? message,\n });\n }\n return err;\n })();\n return new ContractFunctionExecutionError(cause, {\n abi,\n args,\n contractAddress: address,\n docsPath,\n functionName,\n sender,\n });\n}\n//# sourceMappingURL=getContractError.js.map","export const aggregate3Signature = '0x82ad56cb';\n//# sourceMappingURL=contract.js.map","export const deploylessCallViaBytecodeBytecode = '0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe';\nexport const deploylessCallViaFactoryBytecode = '0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe';\nexport const universalSignatureValidatorByteCode = '0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572';\n//# sourceMappingURL=contracts.js.map","const schedulerCache = /*#__PURE__*/ new Map();\n/** @internal */\nexport function createBatchScheduler({ fn, id, shouldSplitBatch, wait = 0, sort, }) {\n const exec = async () => {\n const scheduler = getScheduler();\n flush();\n const args = scheduler.map(({ args }) => args);\n if (args.length === 0)\n return;\n fn(args)\n .then((data) => {\n if (sort && Array.isArray(data))\n data.sort(sort);\n for (let i = 0; i < scheduler.length; i++) {\n const { pendingPromise } = scheduler[i];\n pendingPromise.resolve?.([data[i], data]);\n }\n })\n .catch((err) => {\n for (let i = 0; i < scheduler.length; i++) {\n const { pendingPromise } = scheduler[i];\n pendingPromise.reject?.(err);\n }\n });\n };\n const flush = () => schedulerCache.delete(id);\n const getBatchedArgs = () => getScheduler().map(({ args }) => args);\n const getScheduler = () => schedulerCache.get(id) || [];\n const setScheduler = (item) => schedulerCache.set(id, [...getScheduler(), item]);\n return {\n flush,\n async schedule(args) {\n const pendingPromise = {};\n const promise = new Promise((resolve, reject) => {\n pendingPromise.resolve = resolve;\n pendingPromise.reject = reject;\n });\n const split = shouldSplitBatch?.([...getBatchedArgs(), args]);\n if (split)\n exec();\n const hasActiveScheduler = getScheduler().length > 0;\n if (hasActiveScheduler) {\n setScheduler({ args, pendingPromise });\n return promise;\n }\n setScheduler({ args, pendingPromise });\n setTimeout(exec, wait);\n return promise;\n },\n };\n}\n//# sourceMappingURL=createBatchScheduler.js.map","import { parseAbi } from 'abitype';\nimport { parseAccount, } from '../../accounts/utils/parseAccount.js';\nimport { multicall3Abi } from '../../constants/abis.js';\nimport { aggregate3Signature } from '../../constants/contract.js';\nimport { deploylessCallViaBytecodeBytecode, deploylessCallViaFactoryBytecode, } from '../../constants/contracts.js';\nimport { BaseError } from '../../errors/base.js';\nimport { ChainDoesNotSupportContract, ClientChainNotConfiguredError, } from '../../errors/chain.js';\nimport { CounterfactualDeploymentFailedError, RawContractError, } from '../../errors/contract.js';\nimport { decodeFunctionResult, } from '../../utils/abi/decodeFunctionResult.js';\nimport { encodeDeployData, } from '../../utils/abi/encodeDeployData.js';\nimport { encodeFunctionData, } from '../../utils/abi/encodeFunctionData.js';\nimport { getChainContractAddress, } from '../../utils/chain/getChainContractAddress.js';\nimport { numberToHex, } from '../../utils/encoding/toHex.js';\nimport { getCallError, } from '../../utils/errors/getCallError.js';\nimport { extract } from '../../utils/formatters/extract.js';\nimport { formatTransactionRequest, } from '../../utils/formatters/transactionRequest.js';\nimport { createBatchScheduler, } from '../../utils/promise/createBatchScheduler.js';\nimport { serializeStateOverride, } from '../../utils/stateOverride.js';\nimport { assertRequest } from '../../utils/transaction/assertRequest.js';\n/**\n * Executes a new message call immediately without submitting a transaction to the network.\n *\n * - Docs: https://viem.sh/docs/actions/public/call\n * - JSON-RPC Methods: [`eth_call`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_call)\n *\n * @param client - Client to use\n * @param parameters - {@link CallParameters}\n * @returns The call data. {@link CallReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { call } from 'viem/public'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const data = await call(client, {\n * account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',\n * data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',\n * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',\n * })\n */\nexport async function call(client, args) {\n const { account: account_ = client.account, batch = Boolean(client.batch?.multicall), blockNumber, blockTag = 'latest', accessList, blobs, code, data: data_, factory, factoryData, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, stateOverride, ...rest } = args;\n const account = account_ ? parseAccount(account_) : undefined;\n if (code && (factory || factoryData))\n throw new BaseError('Cannot provide both `code` & `factory`/`factoryData` as parameters.');\n if (code && to)\n throw new BaseError('Cannot provide both `code` & `to` as parameters.');\n // Check if the call is deployless via bytecode.\n const deploylessCallViaBytecode = code && data_;\n // Check if the call is deployless via a factory.\n const deploylessCallViaFactory = factory && factoryData && to && data_;\n const deploylessCall = deploylessCallViaBytecode || deploylessCallViaFactory;\n const data = (() => {\n if (deploylessCallViaBytecode)\n return toDeploylessCallViaBytecodeData({\n code,\n data: data_,\n });\n if (deploylessCallViaFactory)\n return toDeploylessCallViaFactoryData({\n data: data_,\n factory,\n factoryData,\n to,\n });\n return data_;\n })();\n try {\n assertRequest(args);\n const blockNumberHex = blockNumber ? numberToHex(blockNumber) : undefined;\n const block = blockNumberHex || blockTag;\n const rpcStateOverride = serializeStateOverride(stateOverride);\n const chainFormat = client.chain?.formatters?.transactionRequest?.format;\n const format = chainFormat || formatTransactionRequest;\n const request = format({\n // Pick out extra data that might exist on the chain's transaction request type.\n ...extract(rest, { format: chainFormat }),\n from: account?.address,\n accessList,\n blobs,\n data,\n gas,\n gasPrice,\n maxFeePerBlobGas,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to: deploylessCall ? undefined : to,\n value,\n });\n if (batch && shouldPerformMulticall({ request }) && !rpcStateOverride) {\n try {\n return await scheduleMulticall(client, {\n ...request,\n blockNumber,\n blockTag,\n });\n }\n catch (err) {\n if (!(err instanceof ClientChainNotConfiguredError) &&\n !(err instanceof ChainDoesNotSupportContract))\n throw err;\n }\n }\n const response = await client.request({\n method: 'eth_call',\n params: rpcStateOverride\n ? [\n request,\n block,\n rpcStateOverride,\n ]\n : [request, block],\n });\n if (response === '0x')\n return { data: undefined };\n return { data: response };\n }\n catch (err) {\n const data = getRevertErrorData(err);\n // Check for CCIP-Read offchain lookup signature.\n const { offchainLookup, offchainLookupSignature } = await import('../../utils/ccip.js');\n if (client.ccipRead !== false &&\n data?.slice(0, 10) === offchainLookupSignature &&\n to)\n return { data: await offchainLookup(client, { data, to }) };\n // Check for counterfactual deployment error.\n if (deploylessCall && data?.slice(0, 10) === '0x101bb98d')\n throw new CounterfactualDeploymentFailedError({ factory });\n throw getCallError(err, {\n ...args,\n account,\n chain: client.chain,\n });\n }\n}\n// We only want to perform a scheduled multicall if:\n// - The request has calldata,\n// - The request has a target address,\n// - The target address is not already the aggregate3 signature,\n// - The request has no other properties (`nonce`, `gas`, etc cannot be sent with a multicall).\nfunction shouldPerformMulticall({ request }) {\n const { data, to, ...request_ } = request;\n if (!data)\n return false;\n if (data.startsWith(aggregate3Signature))\n return false;\n if (!to)\n return false;\n if (Object.values(request_).filter((x) => typeof x !== 'undefined').length > 0)\n return false;\n return true;\n}\nasync function scheduleMulticall(client, args) {\n const { batchSize = 1024, wait = 0 } = typeof client.batch?.multicall === 'object' ? client.batch.multicall : {};\n const { blockNumber, blockTag = 'latest', data, multicallAddress: multicallAddress_, to, } = args;\n let multicallAddress = multicallAddress_;\n if (!multicallAddress) {\n if (!client.chain)\n throw new ClientChainNotConfiguredError();\n multicallAddress = getChainContractAddress({\n blockNumber,\n chain: client.chain,\n contract: 'multicall3',\n });\n }\n const blockNumberHex = blockNumber ? numberToHex(blockNumber) : undefined;\n const block = blockNumberHex || blockTag;\n const { schedule } = createBatchScheduler({\n id: `${client.uid}.${block}`,\n wait,\n shouldSplitBatch(args) {\n const size = args.reduce((size, { data }) => size + (data.length - 2), 0);\n return size > batchSize * 2;\n },\n fn: async (requests) => {\n const calls = requests.map((request) => ({\n allowFailure: true,\n callData: request.data,\n target: request.to,\n }));\n const calldata = encodeFunctionData({\n abi: multicall3Abi,\n args: [calls],\n functionName: 'aggregate3',\n });\n const data = await client.request({\n method: 'eth_call',\n params: [\n {\n data: calldata,\n to: multicallAddress,\n },\n block,\n ],\n });\n return decodeFunctionResult({\n abi: multicall3Abi,\n args: [calls],\n functionName: 'aggregate3',\n data: data || '0x',\n });\n },\n });\n const [{ returnData, success }] = await schedule({ data, to });\n if (!success)\n throw new RawContractError({ data: returnData });\n if (returnData === '0x')\n return { data: undefined };\n return { data: returnData };\n}\nfunction toDeploylessCallViaBytecodeData(parameters) {\n const { code, data } = parameters;\n return encodeDeployData({\n abi: parseAbi(['constructor(bytes, bytes)']),\n bytecode: deploylessCallViaBytecodeBytecode,\n args: [code, data],\n });\n}\nfunction toDeploylessCallViaFactoryData(parameters) {\n const { data, factory, factoryData, to } = parameters;\n return encodeDeployData({\n abi: parseAbi(['constructor(address, bytes, address, bytes)']),\n bytecode: deploylessCallViaFactoryBytecode,\n args: [to, data, factory, factoryData],\n });\n}\n/** @internal */\nexport function getRevertErrorData(err) {\n if (!(err instanceof BaseError))\n return undefined;\n const error = err.walk();\n return typeof error?.data === 'object' ? error.data?.data : error.data;\n}\n//# sourceMappingURL=call.js.map","import { decodeFunctionResult, } from '../../utils/abi/decodeFunctionResult.js';\nimport { encodeFunctionData, } from '../../utils/abi/encodeFunctionData.js';\nimport { getContractError, } from '../../utils/errors/getContractError.js';\nimport { getAction } from '../../utils/getAction.js';\nimport { call } from './call.js';\n/**\n * Calls a read-only function on a contract, and returns the response.\n *\n * - Docs: https://viem.sh/docs/contract/readContract\n * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/reading-contracts\n *\n * A \"read-only\" function (constant function) on a Solidity contract is denoted by a `view` or `pure` keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas.\n *\n * Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`call` action](https://viem.sh/docs/actions/public/call) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData).\n *\n * @param client - Client to use\n * @param parameters - {@link ReadContractParameters}\n * @returns The response from the contract. Type is inferred. {@link ReadContractReturnType}\n *\n * @example\n * import { createPublicClient, http, parseAbi } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { readContract } from 'viem/contract'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const result = await readContract(client, {\n * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',\n * abi: parseAbi(['function balanceOf(address) view returns (uint256)']),\n * functionName: 'balanceOf',\n * args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'],\n * })\n * // 424122n\n */\nexport async function readContract(client, parameters) {\n const { abi, address, args, functionName, ...rest } = parameters;\n const calldata = encodeFunctionData({\n abi,\n args,\n functionName,\n });\n try {\n const { data } = await getAction(client, call, 'call')({\n ...rest,\n data: calldata,\n to: address,\n });\n return decodeFunctionResult({\n abi,\n args,\n functionName,\n data: data || '0x',\n });\n }\n catch (error) {\n throw getContractError(error, {\n abi,\n address,\n args,\n docsPath: '/docs/contract/readContract',\n functionName,\n });\n }\n}\n//# sourceMappingURL=readContract.js.map","import { addressResolverAbi, universalResolverResolveAbi, } from '../../constants/abis.js';\nimport { decodeFunctionResult, } from '../../utils/abi/decodeFunctionResult.js';\nimport { encodeFunctionData, } from '../../utils/abi/encodeFunctionData.js';\nimport { getChainContractAddress, } from '../../utils/chain/getChainContractAddress.js';\nimport { trim } from '../../utils/data/trim.js';\nimport { toHex } from '../../utils/encoding/toHex.js';\nimport { isNullUniversalResolverError } from '../../utils/ens/errors.js';\nimport { namehash } from '../../utils/ens/namehash.js';\nimport { packetToBytes, } from '../../utils/ens/packetToBytes.js';\nimport { getAction } from '../../utils/getAction.js';\nimport { readContract, } from '../public/readContract.js';\n/**\n * Gets address for ENS name.\n *\n * - Docs: https://viem.sh/docs/ens/actions/getEnsAddress\n * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens\n *\n * Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.\n *\n * Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this.\n *\n * @param client - Client to use\n * @param parameters - {@link GetEnsAddressParameters}\n * @returns Address for ENS name or `null` if not found. {@link GetEnsAddressReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { getEnsAddress, normalize } from 'viem/ens'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const ensAddress = await getEnsAddress(client, {\n * name: normalize('wevm.eth'),\n * })\n * // '0xd2135CfB216b74109775236E36d4b433F1DF507B'\n */\nexport async function getEnsAddress(client, { blockNumber, blockTag, coinType, name, gatewayUrls, strict, universalResolverAddress: universalResolverAddress_, }) {\n let universalResolverAddress = universalResolverAddress_;\n if (!universalResolverAddress) {\n if (!client.chain)\n throw new Error('client chain not configured. universalResolverAddress is required.');\n universalResolverAddress = getChainContractAddress({\n blockNumber,\n chain: client.chain,\n contract: 'ensUniversalResolver',\n });\n }\n try {\n const functionData = encodeFunctionData({\n abi: addressResolverAbi,\n functionName: 'addr',\n ...(coinType != null\n ? { args: [namehash(name), BigInt(coinType)] }\n : { args: [namehash(name)] }),\n });\n const readContractParameters = {\n address: universalResolverAddress,\n abi: universalResolverResolveAbi,\n functionName: 'resolve',\n args: [toHex(packetToBytes(name)), functionData],\n blockNumber,\n blockTag,\n };\n const readContractAction = getAction(client, readContract, 'readContract');\n const res = gatewayUrls\n ? await readContractAction({\n ...readContractParameters,\n args: [...readContractParameters.args, gatewayUrls],\n })\n : await readContractAction(readContractParameters);\n if (res[0] === '0x')\n return null;\n const address = decodeFunctionResult({\n abi: addressResolverAbi,\n args: coinType != null ? [namehash(name), BigInt(coinType)] : undefined,\n functionName: 'addr',\n data: res[0],\n });\n if (address === '0x')\n return null;\n if (trim(address) === '0x00')\n return null;\n return address;\n }\n catch (err) {\n if (strict)\n throw err;\n if (isNullUniversalResolverError(err, 'resolve'))\n return null;\n throw err;\n }\n}\n//# sourceMappingURL=getEnsAddress.js.map","import { BaseError } from './base.js';\nexport class EnsAvatarInvalidMetadataError extends BaseError {\n constructor({ data }) {\n super('Unable to extract image from metadata. The metadata may be malformed or invalid.', {\n metaMessages: [\n '- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.',\n '',\n `Provided data: ${JSON.stringify(data)}`,\n ],\n name: 'EnsAvatarInvalidMetadataError',\n });\n }\n}\nexport class EnsAvatarInvalidNftUriError extends BaseError {\n constructor({ reason }) {\n super(`ENS NFT avatar URI is invalid. ${reason}`, {\n name: 'EnsAvatarInvalidNftUriError',\n });\n }\n}\nexport class EnsAvatarUriResolutionError extends BaseError {\n constructor({ uri }) {\n super(`Unable to resolve ENS avatar URI \"${uri}\". The URI may be malformed, invalid, or does not respond with a valid image.`, { name: 'EnsAvatarUriResolutionError' });\n }\n}\nexport class EnsAvatarUnsupportedNamespaceError extends BaseError {\n constructor({ namespace }) {\n super(`ENS NFT avatar namespace \"${namespace}\" is not supported. Must be \"erc721\" or \"erc1155\".`, { name: 'EnsAvatarUnsupportedNamespaceError' });\n }\n}\n//# sourceMappingURL=ens.js.map","import { readContract, } from '../../../actions/public/readContract.js';\nimport { EnsAvatarInvalidMetadataError, EnsAvatarInvalidNftUriError, EnsAvatarUnsupportedNamespaceError, EnsAvatarUriResolutionError, } from '../../../errors/ens.js';\nconst networkRegex = /(?https?:\\/\\/[^\\/]*|ipfs:\\/|ipns:\\/|ar:\\/)?(?\\/)?(?ipfs\\/|ipns\\/)?(?[\\w\\-.]+)(?\\/.*)?/;\nconst ipfsHashRegex = /^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\\/(?[\\w\\-.]+))?(?\\/.*)?$/;\nconst base64Regex = /^data:([a-zA-Z\\-/+]*);base64,([^\"].*)/;\nconst dataURIRegex = /^data:([a-zA-Z\\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;\n/** @internal */\nexport async function isImageUri(uri) {\n try {\n const res = await fetch(uri, { method: 'HEAD' });\n // retrieve content type header to check if content is image\n if (res.status === 200) {\n const contentType = res.headers.get('content-type');\n return contentType?.startsWith('image/');\n }\n return false;\n }\n catch (error) {\n // if error is not cors related then fail\n if (typeof error === 'object' && typeof error.response !== 'undefined') {\n return false;\n }\n // fail in NodeJS, since the error is not cors but any other network issue\n // biome-ignore lint/suspicious/noPrototypeBuiltins:\n if (!globalThis.hasOwnProperty('Image'))\n return false;\n // in case of cors, use image api to validate if given url is an actual image\n return new Promise((resolve) => {\n const img = new Image();\n img.onload = () => {\n resolve(true);\n };\n img.onerror = () => {\n resolve(false);\n };\n img.src = uri;\n });\n }\n}\n/** @internal */\nexport function getGateway(custom, defaultGateway) {\n if (!custom)\n return defaultGateway;\n if (custom.endsWith('/'))\n return custom.slice(0, -1);\n return custom;\n}\nexport function resolveAvatarUri({ uri, gatewayUrls, }) {\n const isEncoded = base64Regex.test(uri);\n if (isEncoded)\n return { uri, isOnChain: true, isEncoded };\n const ipfsGateway = getGateway(gatewayUrls?.ipfs, 'https://ipfs.io');\n const arweaveGateway = getGateway(gatewayUrls?.arweave, 'https://arweave.net');\n const networkRegexMatch = uri.match(networkRegex);\n const { protocol, subpath, target, subtarget = '', } = networkRegexMatch?.groups || {};\n const isIPNS = protocol === 'ipns:/' || subpath === 'ipns/';\n const isIPFS = protocol === 'ipfs:/' || subpath === 'ipfs/' || ipfsHashRegex.test(uri);\n if (uri.startsWith('http') && !isIPNS && !isIPFS) {\n let replacedUri = uri;\n if (gatewayUrls?.arweave)\n replacedUri = uri.replace(/https:\\/\\/arweave.net/g, gatewayUrls?.arweave);\n return { uri: replacedUri, isOnChain: false, isEncoded: false };\n }\n if ((isIPNS || isIPFS) && target) {\n return {\n uri: `${ipfsGateway}/${isIPNS ? 'ipns' : 'ipfs'}/${target}${subtarget}`,\n isOnChain: false,\n isEncoded: false,\n };\n }\n if (protocol === 'ar:/' && target) {\n return {\n uri: `${arweaveGateway}/${target}${subtarget || ''}`,\n isOnChain: false,\n isEncoded: false,\n };\n }\n let parsedUri = uri.replace(dataURIRegex, '');\n if (parsedUri.startsWith(' res.json());\n const image = await parseAvatarUri({\n gatewayUrls,\n uri: getJsonImage(res),\n });\n return image;\n }\n catch {\n throw new EnsAvatarUriResolutionError({ uri });\n }\n}\nexport async function parseAvatarUri({ gatewayUrls, uri, }) {\n const { uri: resolvedURI, isOnChain } = resolveAvatarUri({ uri, gatewayUrls });\n if (isOnChain)\n return resolvedURI;\n // check if resolvedURI is an image, if it is return the url\n const isImage = await isImageUri(resolvedURI);\n if (isImage)\n return resolvedURI;\n throw new EnsAvatarUriResolutionError({ uri });\n}\nexport function parseNftUri(uri_) {\n let uri = uri_;\n // parse valid nft spec (CAIP-22/CAIP-29)\n // @see: https://github.com/ChainAgnostic/CAIPs/tree/master/CAIPs\n if (uri.startsWith('did:nft:')) {\n // convert DID to CAIP\n uri = uri.replace('did:nft:', '').replace(/_/g, '/');\n }\n const [reference, asset_namespace, tokenID] = uri.split('/');\n const [eip_namespace, chainID] = reference.split(':');\n const [erc_namespace, contractAddress] = asset_namespace.split(':');\n if (!eip_namespace || eip_namespace.toLowerCase() !== 'eip155')\n throw new EnsAvatarInvalidNftUriError({ reason: 'Only EIP-155 supported' });\n if (!chainID)\n throw new EnsAvatarInvalidNftUriError({ reason: 'Chain ID not found' });\n if (!contractAddress)\n throw new EnsAvatarInvalidNftUriError({\n reason: 'Contract address not found',\n });\n if (!tokenID)\n throw new EnsAvatarInvalidNftUriError({ reason: 'Token ID not found' });\n if (!erc_namespace)\n throw new EnsAvatarInvalidNftUriError({ reason: 'ERC namespace not found' });\n return {\n chainID: Number.parseInt(chainID),\n namespace: erc_namespace.toLowerCase(),\n contractAddress: contractAddress,\n tokenID,\n };\n}\nexport async function getNftTokenUri(client, { nft }) {\n if (nft.namespace === 'erc721') {\n return readContract(client, {\n address: nft.contractAddress,\n abi: [\n {\n name: 'tokenURI',\n type: 'function',\n stateMutability: 'view',\n inputs: [{ name: 'tokenId', type: 'uint256' }],\n outputs: [{ name: '', type: 'string' }],\n },\n ],\n functionName: 'tokenURI',\n args: [BigInt(nft.tokenID)],\n });\n }\n if (nft.namespace === 'erc1155') {\n return readContract(client, {\n address: nft.contractAddress,\n abi: [\n {\n name: 'uri',\n type: 'function',\n stateMutability: 'view',\n inputs: [{ name: '_id', type: 'uint256' }],\n outputs: [{ name: '', type: 'string' }],\n },\n ],\n functionName: 'uri',\n args: [BigInt(nft.tokenID)],\n });\n }\n throw new EnsAvatarUnsupportedNamespaceError({ namespace: nft.namespace });\n}\n//# sourceMappingURL=utils.js.map","import { getJsonImage, getMetadataAvatarUri, getNftTokenUri, parseAvatarUri, parseNftUri, resolveAvatarUri, } from './utils.js';\n/*\n * @description Parses an ENS avatar record.\n *\n * @example\n * parseAvatarRecord('eip155:1/erc1155:0xb32979486938aa9694bfc898f35dbed459f44424/10063')\n * 'https://ipfs.io/ipfs/QmSP4nq9fnN9dAiCj42ug9Wa79rqmQerZXZch82VqpiH7U/image.gif'\n *\n * @see https://docs.ens.domains/web/avatars\n *\n */\nexport async function parseAvatarRecord(client, { gatewayUrls, record, }) {\n if (/eip155:/i.test(record))\n return parseNftAvatarUri(client, { gatewayUrls, record });\n return parseAvatarUri({ uri: record, gatewayUrls });\n}\nasync function parseNftAvatarUri(client, { gatewayUrls, record, }) {\n // parse NFT URI into properties\n const nft = parseNftUri(record);\n // fetch tokenURI from the NFT contract\n const nftUri = await getNftTokenUri(client, { nft });\n // resolve the URI from the fetched tokenURI\n const { uri: resolvedNftUri, isOnChain, isEncoded, } = resolveAvatarUri({ uri: nftUri, gatewayUrls });\n // if the resolved URI is on chain, return the data\n if (isOnChain &&\n (resolvedNftUri.includes('data:application/json;base64,') ||\n resolvedNftUri.startsWith('{'))) {\n const encodedJson = isEncoded\n ? // if it is encoded, decode it\n atob(resolvedNftUri.replace('data:application/json;base64,', ''))\n : // if it isn't encoded assume it is a JSON string, but it could be anything (it will error if it is)\n resolvedNftUri;\n const decoded = JSON.parse(encodedJson);\n return parseAvatarUri({ uri: getJsonImage(decoded), gatewayUrls });\n }\n let uriTokenId = nft.tokenID;\n if (nft.namespace === 'erc1155')\n uriTokenId = uriTokenId.replace('0x', '').padStart(64, '0');\n return getMetadataAvatarUri({\n gatewayUrls,\n uri: resolvedNftUri.replace(/(?:0x)?{id}/, uriTokenId),\n });\n}\n//# sourceMappingURL=parseAvatarRecord.js.map","import { textResolverAbi, universalResolverResolveAbi, } from '../../constants/abis.js';\nimport { decodeFunctionResult, } from '../../utils/abi/decodeFunctionResult.js';\nimport { encodeFunctionData, } from '../../utils/abi/encodeFunctionData.js';\nimport { getChainContractAddress, } from '../../utils/chain/getChainContractAddress.js';\nimport { toHex } from '../../utils/encoding/toHex.js';\nimport { isNullUniversalResolverError } from '../../utils/ens/errors.js';\nimport { namehash } from '../../utils/ens/namehash.js';\nimport { packetToBytes, } from '../../utils/ens/packetToBytes.js';\nimport { getAction } from '../../utils/getAction.js';\nimport { readContract, } from '../public/readContract.js';\n/**\n * Gets a text record for specified ENS name.\n *\n * - Docs: https://viem.sh/docs/ens/actions/getEnsResolver\n * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens\n *\n * Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.\n *\n * Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this.\n *\n * @param client - Client to use\n * @param parameters - {@link GetEnsTextParameters}\n * @returns Address for ENS resolver. {@link GetEnsTextReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { getEnsText, normalize } from 'viem/ens'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const twitterRecord = await getEnsText(client, {\n * name: normalize('wevm.eth'),\n * key: 'com.twitter',\n * })\n * // 'wevm_dev'\n */\nexport async function getEnsText(client, { blockNumber, blockTag, name, key, gatewayUrls, strict, universalResolverAddress: universalResolverAddress_, }) {\n let universalResolverAddress = universalResolverAddress_;\n if (!universalResolverAddress) {\n if (!client.chain)\n throw new Error('client chain not configured. universalResolverAddress is required.');\n universalResolverAddress = getChainContractAddress({\n blockNumber,\n chain: client.chain,\n contract: 'ensUniversalResolver',\n });\n }\n try {\n const readContractParameters = {\n address: universalResolverAddress,\n abi: universalResolverResolveAbi,\n functionName: 'resolve',\n args: [\n toHex(packetToBytes(name)),\n encodeFunctionData({\n abi: textResolverAbi,\n functionName: 'text',\n args: [namehash(name), key],\n }),\n ],\n blockNumber,\n blockTag,\n };\n const readContractAction = getAction(client, readContract, 'readContract');\n const res = gatewayUrls\n ? await readContractAction({\n ...readContractParameters,\n args: [...readContractParameters.args, gatewayUrls],\n })\n : await readContractAction(readContractParameters);\n if (res[0] === '0x')\n return null;\n const record = decodeFunctionResult({\n abi: textResolverAbi,\n functionName: 'text',\n data: res[0],\n });\n return record === '' ? null : record;\n }\n catch (err) {\n if (strict)\n throw err;\n if (isNullUniversalResolverError(err, 'resolve'))\n return null;\n throw err;\n }\n}\n//# sourceMappingURL=getEnsText.js.map","import { parseAvatarRecord, } from '../../utils/ens/avatar/parseAvatarRecord.js';\nimport { getAction } from '../../utils/getAction.js';\nimport { getEnsText, } from './getEnsText.js';\n/**\n * Gets the avatar of an ENS name.\n *\n * - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar\n * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens\n *\n * Calls [`getEnsText`](https://viem.sh/docs/ens/actions/getEnsText) with `key` set to `'avatar'`.\n *\n * Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this.\n *\n * @param client - Client to use\n * @param parameters - {@link GetEnsAvatarParameters}\n * @returns Avatar URI or `null` if not found. {@link GetEnsAvatarReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { getEnsAvatar, normalize } from 'viem/ens'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const ensAvatar = await getEnsAvatar(client, {\n * name: normalize('wevm.eth'),\n * })\n * // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'\n */\nexport async function getEnsAvatar(client, { blockNumber, blockTag, assetGatewayUrls, name, gatewayUrls, strict, universalResolverAddress, }) {\n const record = await getAction(client, getEnsText, 'getEnsText')({\n blockNumber,\n blockTag,\n key: 'avatar',\n name,\n universalResolverAddress,\n gatewayUrls,\n strict,\n });\n if (!record)\n return null;\n try {\n return await parseAvatarRecord(client, {\n record,\n gatewayUrls: assetGatewayUrls,\n });\n }\n catch {\n return null;\n }\n}\n//# sourceMappingURL=getEnsAvatar.js.map","import { universalResolverReverseAbi } from '../../constants/abis.js';\nimport { getChainContractAddress, } from '../../utils/chain/getChainContractAddress.js';\nimport { toHex } from '../../utils/encoding/toHex.js';\nimport { isNullUniversalResolverError } from '../../utils/ens/errors.js';\nimport { packetToBytes, } from '../../utils/ens/packetToBytes.js';\nimport { getAction } from '../../utils/getAction.js';\nimport { readContract, } from '../public/readContract.js';\n/**\n * Gets primary name for specified address.\n *\n * - Docs: https://viem.sh/docs/ens/actions/getEnsName\n * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens\n *\n * Calls `reverse(bytes)` on ENS Universal Resolver Contract to \"reverse resolve\" the address to the primary ENS name.\n *\n * @param client - Client to use\n * @param parameters - {@link GetEnsNameParameters}\n * @returns Name or `null` if not found. {@link GetEnsNameReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { getEnsName } from 'viem/ens'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const ensName = await getEnsName(client, {\n * address: '0xd2135CfB216b74109775236E36d4b433F1DF507B',\n * })\n * // 'wevm.eth'\n */\nexport async function getEnsName(client, { address, blockNumber, blockTag, gatewayUrls, strict, universalResolverAddress: universalResolverAddress_, }) {\n let universalResolverAddress = universalResolverAddress_;\n if (!universalResolverAddress) {\n if (!client.chain)\n throw new Error('client chain not configured. universalResolverAddress is required.');\n universalResolverAddress = getChainContractAddress({\n blockNumber,\n chain: client.chain,\n contract: 'ensUniversalResolver',\n });\n }\n const reverseNode = `${address.toLowerCase().substring(2)}.addr.reverse`;\n try {\n const readContractParameters = {\n address: universalResolverAddress,\n abi: universalResolverReverseAbi,\n functionName: 'reverse',\n args: [toHex(packetToBytes(reverseNode))],\n blockNumber,\n blockTag,\n };\n const readContractAction = getAction(client, readContract, 'readContract');\n const [name, resolvedAddress] = gatewayUrls\n ? await readContractAction({\n ...readContractParameters,\n args: [...readContractParameters.args, gatewayUrls],\n })\n : await readContractAction(readContractParameters);\n if (address.toLowerCase() !== resolvedAddress.toLowerCase())\n return null;\n return name;\n }\n catch (err) {\n if (strict)\n throw err;\n if (isNullUniversalResolverError(err, 'reverse'))\n return null;\n throw err;\n }\n}\n//# sourceMappingURL=getEnsName.js.map","/** @internal */\nexport const promiseCache = /*#__PURE__*/ new Map();\n/** @internal */\nexport const responseCache = /*#__PURE__*/ new Map();\nexport function getCache(cacheKey) {\n const buildCache = (cacheKey, cache) => ({\n clear: () => cache.delete(cacheKey),\n get: () => cache.get(cacheKey),\n set: (data) => cache.set(cacheKey, data),\n });\n const promise = buildCache(cacheKey, promiseCache);\n const response = buildCache(cacheKey, responseCache);\n return {\n clear: () => {\n promise.clear();\n response.clear();\n },\n promise,\n response,\n };\n}\n/**\n * @description Returns the result of a given promise, and caches the result for\n * subsequent invocations against a provided cache key.\n */\nexport async function withCache(fn, { cacheKey, cacheTime = Number.POSITIVE_INFINITY }) {\n const cache = getCache(cacheKey);\n // If a response exists in the cache, and it's not expired, return it\n // and do not invoke the promise.\n // If the max age is 0, the cache is disabled.\n const response = cache.response.get();\n if (response && cacheTime > 0) {\n const age = new Date().getTime() - response.created.getTime();\n if (age < cacheTime)\n return response.data;\n }\n let promise = cache.promise.get();\n if (!promise) {\n promise = fn();\n // Store the promise in the cache so that subsequent invocations\n // will wait for the same promise to resolve (deduping).\n cache.promise.set(promise);\n }\n try {\n const data = await promise;\n // Store the response in the cache so that subsequent invocations\n // will return the same response.\n cache.response.set({ created: new Date(), data });\n return data;\n }\n finally {\n // Clear the promise cache so that subsequent invocations will\n // invoke the promise again.\n cache.promise.clear();\n }\n}\n//# sourceMappingURL=withCache.js.map","import { getCache, withCache, } from '../../utils/promise/withCache.js';\nconst cacheKey = (id) => `blockNumber.${id}`;\n/** @internal */\nexport function getBlockNumberCache(id) {\n return getCache(cacheKey(id));\n}\n/**\n * Returns the number of the most recent block seen.\n *\n * - Docs: https://viem.sh/docs/actions/public/getBlockNumber\n * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks_fetching-blocks\n * - JSON-RPC Methods: [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber)\n *\n * @param client - Client to use\n * @param parameters - {@link GetBlockNumberParameters}\n * @returns The number of the block. {@link GetBlockNumberReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { getBlockNumber } from 'viem/public'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const blockNumber = await getBlockNumber(client)\n * // 69420n\n */\nexport async function getBlockNumber(client, { cacheTime = client.cacheTime } = {}) {\n const blockNumberHex = await withCache(() => client.request({\n method: 'eth_blockNumber',\n }), { cacheKey: cacheKey(client.uid), cacheTime });\n return BigInt(blockNumberHex);\n}\n//# sourceMappingURL=getBlockNumber.js.map","import { InvalidAddressError, } from '../../errors/address.js';\nimport { isAddress } from './isAddress.js';\nexport function isAddressEqual(a, b) {\n if (!isAddress(a, { strict: false }))\n throw new InvalidAddressError({ address: a });\n if (!isAddress(b, { strict: false }))\n throw new InvalidAddressError({ address: b });\n return a.toLowerCase() === b.toLowerCase();\n}\n//# sourceMappingURL=isAddressEqual.js.map","import { TransactionNotFoundError } from '../../errors/transaction.js';\nimport { numberToHex, } from '../../utils/encoding/toHex.js';\nimport { formatTransaction, } from '../../utils/formatters/transaction.js';\n/**\n * Returns information about a [Transaction](https://viem.sh/docs/glossary/terms#transaction) given a hash or block identifier.\n *\n * - Docs: https://viem.sh/docs/actions/public/getTransaction\n * - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions\n * - JSON-RPC Methods: [`eth_getTransactionByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionByHash)\n *\n * @param client - Client to use\n * @param parameters - {@link GetTransactionParameters}\n * @returns The transaction information. {@link GetTransactionReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { getTransaction } from 'viem/public'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const transaction = await getTransaction(client, {\n * hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',\n * })\n */\nexport async function getTransaction(client, { blockHash, blockNumber, blockTag: blockTag_, hash, index, }) {\n const blockTag = blockTag_ || 'latest';\n const blockNumberHex = blockNumber !== undefined ? numberToHex(blockNumber) : undefined;\n let transaction = null;\n if (hash) {\n transaction = await client.request({\n method: 'eth_getTransactionByHash',\n params: [hash],\n }, { dedupe: true });\n }\n else if (blockHash) {\n transaction = await client.request({\n method: 'eth_getTransactionByBlockHashAndIndex',\n params: [blockHash, numberToHex(index)],\n }, { dedupe: true });\n }\n else if (blockNumberHex || blockTag) {\n transaction = await client.request({\n method: 'eth_getTransactionByBlockNumberAndIndex',\n params: [blockNumberHex || blockTag, numberToHex(index)],\n }, { dedupe: Boolean(blockNumberHex) });\n }\n if (!transaction)\n throw new TransactionNotFoundError({\n blockHash,\n blockNumber,\n blockTag,\n hash,\n index,\n });\n const format = client.chain?.formatters?.transaction?.format || formatTransaction;\n return format(transaction);\n}\n//# sourceMappingURL=getTransaction.js.map","import { TransactionReceiptNotFoundError, } from '../../errors/transaction.js';\nimport { formatTransactionReceipt, } from '../../utils/formatters/transactionReceipt.js';\n/**\n * Returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms#transaction-receipt) given a [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash.\n *\n * - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt\n * - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions\n * - JSON-RPC Methods: [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionreceipt)\n *\n * @param client - Client to use\n * @param parameters - {@link GetTransactionReceiptParameters}\n * @returns The transaction receipt. {@link GetTransactionReceiptReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { getTransactionReceipt } from 'viem/public'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const transactionReceipt = await getTransactionReceipt(client, {\n * hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',\n * })\n */\nexport async function getTransactionReceipt(client, { hash }) {\n const receipt = await client.request({\n method: 'eth_getTransactionReceipt',\n params: [hash],\n }, { dedupe: true });\n if (!receipt)\n throw new TransactionReceiptNotFoundError({ hash });\n const format = client.chain?.formatters?.transactionReceipt?.format ||\n formatTransactionReceipt;\n return format(receipt);\n}\n//# sourceMappingURL=getTransactionReceipt.js.map","import { multicall3Abi } from '../../constants/abis.js';\nimport { AbiDecodingZeroDataError } from '../../errors/abi.js';\nimport { BaseError } from '../../errors/base.js';\nimport { RawContractError } from '../../errors/contract.js';\nimport { decodeFunctionResult, } from '../../utils/abi/decodeFunctionResult.js';\nimport { encodeFunctionData, } from '../../utils/abi/encodeFunctionData.js';\nimport { getChainContractAddress, } from '../../utils/chain/getChainContractAddress.js';\nimport { getContractError, } from '../../utils/errors/getContractError.js';\nimport { getAction } from '../../utils/getAction.js';\nimport { readContract } from './readContract.js';\n/**\n * Similar to [`readContract`](https://viem.sh/docs/contract/readContract), but batches up multiple functions on a contract in a single RPC call via the [`multicall3` contract](https://github.com/mds1/multicall).\n *\n * - Docs: https://viem.sh/docs/contract/multicall\n *\n * @param client - Client to use\n * @param parameters - {@link MulticallParameters}\n * @returns An array of results with accompanying status. {@link MulticallReturnType}\n *\n * @example\n * import { createPublicClient, http, parseAbi } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { multicall } from 'viem/contract'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const abi = parseAbi([\n * 'function balanceOf(address) view returns (uint256)',\n * 'function totalSupply() view returns (uint256)',\n * ])\n * const results = await multicall(client, {\n * contracts: [\n * {\n * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',\n * abi,\n * functionName: 'balanceOf',\n * args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'],\n * },\n * {\n * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',\n * abi,\n * functionName: 'totalSupply',\n * },\n * ],\n * })\n * // [{ result: 424122n, status: 'success' }, { result: 1000000n, status: 'success' }]\n */\nexport async function multicall(client, parameters) {\n const { allowFailure = true, batchSize: batchSize_, blockNumber, blockTag, multicallAddress: multicallAddress_, stateOverride, } = parameters;\n const contracts = parameters.contracts;\n const batchSize = batchSize_ ??\n ((typeof client.batch?.multicall === 'object' &&\n client.batch.multicall.batchSize) ||\n 1_024);\n let multicallAddress = multicallAddress_;\n if (!multicallAddress) {\n if (!client.chain)\n throw new Error('client chain not configured. multicallAddress is required.');\n multicallAddress = getChainContractAddress({\n blockNumber,\n chain: client.chain,\n contract: 'multicall3',\n });\n }\n const chunkedCalls = [[]];\n let currentChunk = 0;\n let currentChunkSize = 0;\n for (let i = 0; i < contracts.length; i++) {\n const { abi, address, args, functionName } = contracts[i];\n try {\n const callData = encodeFunctionData({ abi, args, functionName });\n currentChunkSize += (callData.length - 2) / 2;\n // Check to see if we need to create a new chunk.\n if (\n // Check if batching is enabled.\n batchSize > 0 &&\n // Check if the current size of the batch exceeds the size limit.\n currentChunkSize > batchSize &&\n // Check if the current chunk is not already empty.\n chunkedCalls[currentChunk].length > 0) {\n currentChunk++;\n currentChunkSize = (callData.length - 2) / 2;\n chunkedCalls[currentChunk] = [];\n }\n chunkedCalls[currentChunk] = [\n ...chunkedCalls[currentChunk],\n {\n allowFailure: true,\n callData,\n target: address,\n },\n ];\n }\n catch (err) {\n const error = getContractError(err, {\n abi,\n address,\n args,\n docsPath: '/docs/contract/multicall',\n functionName,\n });\n if (!allowFailure)\n throw error;\n chunkedCalls[currentChunk] = [\n ...chunkedCalls[currentChunk],\n {\n allowFailure: true,\n callData: '0x',\n target: address,\n },\n ];\n }\n }\n const aggregate3Results = await Promise.allSettled(chunkedCalls.map((calls) => getAction(client, readContract, 'readContract')({\n abi: multicall3Abi,\n address: multicallAddress,\n args: [calls],\n blockNumber,\n blockTag,\n functionName: 'aggregate3',\n stateOverride,\n })));\n const results = [];\n for (let i = 0; i < aggregate3Results.length; i++) {\n const result = aggregate3Results[i];\n // If an error occurred in a `readContract` invocation (ie. network error),\n // then append the failure reason to each contract result.\n if (result.status === 'rejected') {\n if (!allowFailure)\n throw result.reason;\n for (let j = 0; j < chunkedCalls[i].length; j++) {\n results.push({\n status: 'failure',\n error: result.reason,\n result: undefined,\n });\n }\n continue;\n }\n // If the `readContract` call was successful, then decode the results.\n const aggregate3Result = result.value;\n for (let j = 0; j < aggregate3Result.length; j++) {\n // Extract the response from `readContract`\n const { returnData, success } = aggregate3Result[j];\n // Extract the request call data from the original call.\n const { callData } = chunkedCalls[i][j];\n // Extract the contract config for this call from the `contracts` argument\n // for decoding.\n const { abi, address, functionName, args } = contracts[results.length];\n try {\n if (callData === '0x')\n throw new AbiDecodingZeroDataError();\n if (!success)\n throw new RawContractError({ data: returnData });\n const result = decodeFunctionResult({\n abi,\n args,\n data: returnData,\n functionName,\n });\n results.push(allowFailure ? { result, status: 'success' } : result);\n }\n catch (err) {\n const error = getContractError(err, {\n abi,\n address,\n args,\n docsPath: '/docs/contract/multicall',\n functionName,\n });\n if (!allowFailure)\n throw error;\n results.push({ error, result: undefined, status: 'failure' });\n }\n }\n }\n if (results.length !== contracts.length)\n throw new BaseError('multicall results mismatch');\n return results;\n}\n//# sourceMappingURL=multicall.js.map","/** @internal */\nexport const listenersCache = /*#__PURE__*/ new Map();\n/** @internal */\nexport const cleanupCache = /*#__PURE__*/ new Map();\nlet callbackCount = 0;\n/**\n * @description Sets up an observer for a given function. If another function\n * is set up under the same observer id, the function will only be called once\n * for both instances of the observer.\n */\nexport function observe(observerId, callbacks, fn) {\n const callbackId = ++callbackCount;\n const getListeners = () => listenersCache.get(observerId) || [];\n const unsubscribe = () => {\n const listeners = getListeners();\n listenersCache.set(observerId, listeners.filter((cb) => cb.id !== callbackId));\n };\n const unwatch = () => {\n const cleanup = cleanupCache.get(observerId);\n if (getListeners().length === 1 && cleanup)\n cleanup();\n unsubscribe();\n };\n const listeners = getListeners();\n listenersCache.set(observerId, [\n ...listeners,\n { id: callbackId, fns: callbacks },\n ]);\n if (listeners && listeners.length > 0)\n return unwatch;\n const emit = {};\n for (const key in callbacks) {\n emit[key] = ((...args) => {\n const listeners = getListeners();\n if (listeners.length === 0)\n return;\n for (const listener of listeners)\n listener.fns[key]?.(...args);\n });\n }\n const cleanup = fn(emit);\n if (typeof cleanup === 'function')\n cleanupCache.set(observerId, cleanup);\n return unwatch;\n}\n//# sourceMappingURL=observe.js.map","export async function wait(time) {\n return new Promise((res) => setTimeout(res, time));\n}\n//# sourceMappingURL=wait.js.map","import { wait } from './wait.js';\n/**\n * @description Polls a function at a specified interval.\n */\nexport function poll(fn, { emitOnBegin, initialWaitTime, interval }) {\n let active = true;\n const unwatch = () => (active = false);\n const watch = async () => {\n let data = undefined;\n if (emitOnBegin)\n data = await fn({ unpoll: unwatch });\n const initialWait = (await initialWaitTime?.(data)) ?? interval;\n await wait(initialWait);\n const poll = async () => {\n if (!active)\n return;\n await fn({ unpoll: unwatch });\n await wait(interval);\n poll();\n };\n poll();\n };\n watch();\n return unwatch;\n}\n//# sourceMappingURL=poll.js.map","import { hexToBigInt } from '../../utils/encoding/fromHex.js';\nimport { getAction } from '../../utils/getAction.js';\nimport { observe } from '../../utils/observe.js';\nimport { poll } from '../../utils/poll.js';\nimport { stringify } from '../../utils/stringify.js';\nimport { getBlockNumber, } from './getBlockNumber.js';\n/**\n * Watches and returns incoming block numbers.\n *\n * - Docs: https://viem.sh/docs/actions/public/watchBlockNumber\n * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/watching-blocks\n * - JSON-RPC Methods:\n * - When `poll: true`, calls [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber) on a polling interval.\n * - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `\"newHeads\"` event.\n *\n * @param client - Client to use\n * @param parameters - {@link WatchBlockNumberParameters}\n * @returns A function that can be invoked to stop watching for new block numbers. {@link WatchBlockNumberReturnType}\n *\n * @example\n * import { createPublicClient, watchBlockNumber, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const unwatch = watchBlockNumber(client, {\n * onBlockNumber: (blockNumber) => console.log(blockNumber),\n * })\n */\nexport function watchBlockNumber(client, { emitOnBegin = false, emitMissed = false, onBlockNumber, onError, poll: poll_, pollingInterval = client.pollingInterval, }) {\n const enablePolling = (() => {\n if (typeof poll_ !== 'undefined')\n return poll_;\n if (client.transport.type === 'webSocket')\n return false;\n if (client.transport.type === 'fallback' &&\n client.transport.transports[0].config.type === 'webSocket')\n return false;\n return true;\n })();\n let prevBlockNumber;\n const pollBlockNumber = () => {\n const observerId = stringify([\n 'watchBlockNumber',\n client.uid,\n emitOnBegin,\n emitMissed,\n pollingInterval,\n ]);\n return observe(observerId, { onBlockNumber, onError }, (emit) => poll(async () => {\n try {\n const blockNumber = await getAction(client, getBlockNumber, 'getBlockNumber')({ cacheTime: 0 });\n if (prevBlockNumber) {\n // If the current block number is the same as the previous,\n // we can skip.\n if (blockNumber === prevBlockNumber)\n return;\n // If we have missed out on some previous blocks, and the\n // `emitMissed` flag is truthy, let's emit those blocks.\n if (blockNumber - prevBlockNumber > 1 && emitMissed) {\n for (let i = prevBlockNumber + 1n; i < blockNumber; i++) {\n emit.onBlockNumber(i, prevBlockNumber);\n prevBlockNumber = i;\n }\n }\n }\n // If the next block number is greater than the previous,\n // it is not in the past, and we can emit the new block number.\n if (!prevBlockNumber || blockNumber > prevBlockNumber) {\n emit.onBlockNumber(blockNumber, prevBlockNumber);\n prevBlockNumber = blockNumber;\n }\n }\n catch (err) {\n emit.onError?.(err);\n }\n }, {\n emitOnBegin,\n interval: pollingInterval,\n }));\n };\n const subscribeBlockNumber = () => {\n const observerId = stringify([\n 'watchBlockNumber',\n client.uid,\n emitOnBegin,\n emitMissed,\n ]);\n return observe(observerId, { onBlockNumber, onError }, (emit) => {\n let active = true;\n let unsubscribe = () => (active = false);\n (async () => {\n try {\n const transport = (() => {\n if (client.transport.type === 'fallback') {\n const transport = client.transport.transports.find((transport) => transport.config.type === 'webSocket');\n if (!transport)\n return client.transport;\n return transport.value;\n }\n return client.transport;\n })();\n const { unsubscribe: unsubscribe_ } = await transport.subscribe({\n params: ['newHeads'],\n onData(data) {\n if (!active)\n return;\n const blockNumber = hexToBigInt(data.result?.number);\n emit.onBlockNumber(blockNumber, prevBlockNumber);\n prevBlockNumber = blockNumber;\n },\n onError(error) {\n emit.onError?.(error);\n },\n });\n unsubscribe = unsubscribe_;\n if (!active)\n unsubscribe();\n }\n catch (err) {\n onError?.(err);\n }\n })();\n return () => unsubscribe();\n });\n };\n return enablePolling ? pollBlockNumber() : subscribeBlockNumber();\n}\n//# sourceMappingURL=watchBlockNumber.js.map","import { LruMap } from '../lru.js';\n/** @internal */\nexport const promiseCache = /*#__PURE__*/ new LruMap(8192);\n/** Deduplicates in-flight promises. */\nexport function withDedupe(fn, { enabled = true, id }) {\n if (!enabled || !id)\n return fn();\n if (promiseCache.get(id))\n return promiseCache.get(id);\n const promise = fn().finally(() => promiseCache.delete(id));\n promiseCache.set(id, promise);\n return promise;\n}\n//# sourceMappingURL=withDedupe.js.map","import { wait } from '../wait.js';\nexport function withRetry(fn, { delay: delay_ = 100, retryCount = 2, shouldRetry = () => true, } = {}) {\n return new Promise((resolve, reject) => {\n const attemptRetry = async ({ count = 0 } = {}) => {\n const retry = async ({ error }) => {\n const delay = typeof delay_ === 'function' ? delay_({ count, error }) : delay_;\n if (delay)\n await wait(delay);\n attemptRetry({ count: count + 1 });\n };\n try {\n const data = await fn();\n resolve(data);\n }\n catch (err) {\n if (count < retryCount &&\n (await shouldRetry({ count, error: err })))\n return retry({ error: err });\n reject(err);\n }\n };\n attemptRetry();\n });\n}\n//# sourceMappingURL=withRetry.js.map","import { BaseError } from '../errors/base.js';\nimport { HttpRequestError, } from '../errors/request.js';\nimport { ChainDisconnectedError, InternalRpcError, InvalidInputRpcError, InvalidParamsRpcError, InvalidRequestRpcError, JsonRpcVersionUnsupportedError, LimitExceededRpcError, MethodNotFoundRpcError, MethodNotSupportedRpcError, ParseRpcError, ProviderDisconnectedError, ResourceNotFoundRpcError, ResourceUnavailableRpcError, SwitchChainError, TransactionRejectedRpcError, UnauthorizedProviderError, UnknownRpcError, UnsupportedProviderMethodError, UserRejectedRequestError, } from '../errors/rpc.js';\nimport { stringToHex } from './encoding/toHex.js';\nimport { keccak256 } from './hash/keccak256.js';\nimport { withDedupe } from './promise/withDedupe.js';\nimport { withRetry } from './promise/withRetry.js';\nimport { stringify } from './stringify.js';\nexport function buildRequest(request, options = {}) {\n return async (args, overrideOptions = {}) => {\n const { dedupe = false, retryDelay = 150, retryCount = 3, uid, } = {\n ...options,\n ...overrideOptions,\n };\n const requestId = dedupe\n ? keccak256(stringToHex(`${uid}.${stringify(args)}`))\n : undefined;\n return withDedupe(() => withRetry(async () => {\n try {\n return await request(args);\n }\n catch (err_) {\n const err = err_;\n switch (err.code) {\n // -32700\n case ParseRpcError.code:\n throw new ParseRpcError(err);\n // -32600\n case InvalidRequestRpcError.code:\n throw new InvalidRequestRpcError(err);\n // -32601\n case MethodNotFoundRpcError.code:\n throw new MethodNotFoundRpcError(err, { method: args.method });\n // -32602\n case InvalidParamsRpcError.code:\n throw new InvalidParamsRpcError(err);\n // -32603\n case InternalRpcError.code:\n throw new InternalRpcError(err);\n // -32000\n case InvalidInputRpcError.code:\n throw new InvalidInputRpcError(err);\n // -32001\n case ResourceNotFoundRpcError.code:\n throw new ResourceNotFoundRpcError(err);\n // -32002\n case ResourceUnavailableRpcError.code:\n throw new ResourceUnavailableRpcError(err);\n // -32003\n case TransactionRejectedRpcError.code:\n throw new TransactionRejectedRpcError(err);\n // -32004\n case MethodNotSupportedRpcError.code:\n throw new MethodNotSupportedRpcError(err, {\n method: args.method,\n });\n // -32005\n case LimitExceededRpcError.code:\n throw new LimitExceededRpcError(err);\n // -32006\n case JsonRpcVersionUnsupportedError.code:\n throw new JsonRpcVersionUnsupportedError(err);\n // 4001\n case UserRejectedRequestError.code:\n throw new UserRejectedRequestError(err);\n // 4100\n case UnauthorizedProviderError.code:\n throw new UnauthorizedProviderError(err);\n // 4200\n case UnsupportedProviderMethodError.code:\n throw new UnsupportedProviderMethodError(err);\n // 4900\n case ProviderDisconnectedError.code:\n throw new ProviderDisconnectedError(err);\n // 4901\n case ChainDisconnectedError.code:\n throw new ChainDisconnectedError(err);\n // 4902\n case SwitchChainError.code:\n throw new SwitchChainError(err);\n // CAIP-25: User Rejected Error\n // https://docs.walletconnect.com/2.0/specs/clients/sign/error-codes#rejected-caip-25\n case 5000:\n throw new UserRejectedRequestError(err);\n default:\n if (err_ instanceof BaseError)\n throw err_;\n throw new UnknownRpcError(err);\n }\n }\n }, {\n delay: ({ count, error }) => {\n // If we find a Retry-After header, let's retry after the given time.\n if (error && error instanceof HttpRequestError) {\n const retryAfter = error?.headers?.get('Retry-After');\n if (retryAfter?.match(/\\d/))\n return Number.parseInt(retryAfter) * 1000;\n }\n // Otherwise, let's retry with an exponential backoff.\n return ~~(1 << count) * retryDelay;\n },\n retryCount,\n shouldRetry: ({ error }) => shouldRetry(error),\n }), { enabled: dedupe, id: requestId });\n };\n}\n/** @internal */\nexport function shouldRetry(error) {\n if ('code' in error && typeof error.code === 'number') {\n if (error.code === -1)\n return true; // Unknown error\n if (error.code === LimitExceededRpcError.code)\n return true;\n if (error.code === InternalRpcError.code)\n return true;\n return false;\n }\n if (error instanceof HttpRequestError && error.status) {\n // Forbidden\n if (error.status === 403)\n return true;\n // Request Timeout\n if (error.status === 408)\n return true;\n // Request Entity Too Large\n if (error.status === 413)\n return true;\n // Too Many Requests\n if (error.status === 429)\n return true;\n // Internal Server Error\n if (error.status === 500)\n return true;\n // Bad Gateway\n if (error.status === 502)\n return true;\n // Service Unavailable\n if (error.status === 503)\n return true;\n // Gateway Timeout\n if (error.status === 504)\n return true;\n return false;\n }\n return true;\n}\n//# sourceMappingURL=buildRequest.js.map","import { stringify } from '../utils/stringify.js';\nimport { BaseError } from './base.js';\nimport { getUrl } from './utils.js';\nexport class OffchainLookupError extends BaseError {\n constructor({ callbackSelector, cause, data, extraData, sender, urls, }) {\n super(cause.shortMessage ||\n 'An error occurred while fetching for an offchain result.', {\n cause,\n metaMessages: [\n ...(cause.metaMessages || []),\n cause.metaMessages?.length ? '' : [],\n 'Offchain Gateway Call:',\n urls && [\n ' Gateway URL(s):',\n ...urls.map((url) => ` ${getUrl(url)}`),\n ],\n ` Sender: ${sender}`,\n ` Data: ${data}`,\n ` Callback selector: ${callbackSelector}`,\n ` Extra data: ${extraData}`,\n ].flat(),\n name: 'OffchainLookupError',\n });\n }\n}\nexport class OffchainLookupResponseMalformedError extends BaseError {\n constructor({ result, url }) {\n super('Offchain gateway response is malformed. Response data must be a hex value.', {\n metaMessages: [\n `Gateway URL: ${getUrl(url)}`,\n `Response: ${stringify(result)}`,\n ],\n name: 'OffchainLookupResponseMalformedError',\n });\n }\n}\nexport class OffchainLookupSenderMismatchError extends BaseError {\n constructor({ sender, to }) {\n super('Reverted sender address does not match target contract address (`to`).', {\n metaMessages: [\n `Contract address: ${to}`,\n `OffchainLookup sender address: ${sender}`,\n ],\n name: 'OffchainLookupSenderMismatchError',\n });\n }\n}\n//# sourceMappingURL=ccip.js.map","import { call } from '../actions/public/call.js';\nimport { OffchainLookupError, OffchainLookupResponseMalformedError, OffchainLookupSenderMismatchError, } from '../errors/ccip.js';\nimport { HttpRequestError, } from '../errors/request.js';\nimport { decodeErrorResult } from './abi/decodeErrorResult.js';\nimport { encodeAbiParameters } from './abi/encodeAbiParameters.js';\nimport { isAddressEqual } from './address/isAddressEqual.js';\nimport { concat } from './data/concat.js';\nimport { isHex } from './data/isHex.js';\nimport { stringify } from './stringify.js';\nexport const offchainLookupSignature = '0x556f1830';\nexport const offchainLookupAbiItem = {\n name: 'OffchainLookup',\n type: 'error',\n inputs: [\n {\n name: 'sender',\n type: 'address',\n },\n {\n name: 'urls',\n type: 'string[]',\n },\n {\n name: 'callData',\n type: 'bytes',\n },\n {\n name: 'callbackFunction',\n type: 'bytes4',\n },\n {\n name: 'extraData',\n type: 'bytes',\n },\n ],\n};\nexport async function offchainLookup(client, { blockNumber, blockTag, data, to, }) {\n const { args } = decodeErrorResult({\n data,\n abi: [offchainLookupAbiItem],\n });\n const [sender, urls, callData, callbackSelector, extraData] = args;\n const { ccipRead } = client;\n const ccipRequest_ = ccipRead && typeof ccipRead?.request === 'function'\n ? ccipRead.request\n : ccipRequest;\n try {\n if (!isAddressEqual(to, sender))\n throw new OffchainLookupSenderMismatchError({ sender, to });\n const result = await ccipRequest_({ data: callData, sender, urls });\n const { data: data_ } = await call(client, {\n blockNumber,\n blockTag,\n data: concat([\n callbackSelector,\n encodeAbiParameters([{ type: 'bytes' }, { type: 'bytes' }], [result, extraData]),\n ]),\n to,\n });\n return data_;\n }\n catch (err) {\n throw new OffchainLookupError({\n callbackSelector,\n cause: err,\n data,\n extraData,\n sender,\n urls,\n });\n }\n}\nexport async function ccipRequest({ data, sender, urls, }) {\n let error = new Error('An unknown error occurred.');\n for (let i = 0; i < urls.length; i++) {\n const url = urls[i];\n const method = url.includes('{data}') ? 'GET' : 'POST';\n const body = method === 'POST' ? { data, sender } : undefined;\n const headers = method === 'POST' ? { 'Content-Type': 'application/json' } : {};\n try {\n const response = await fetch(url.replace('{sender}', sender).replace('{data}', data), {\n body: JSON.stringify(body),\n headers,\n method,\n });\n let result;\n if (response.headers.get('Content-Type')?.startsWith('application/json')) {\n result = (await response.json()).data;\n }\n else {\n result = (await response.text());\n }\n if (!response.ok) {\n error = new HttpRequestError({\n body,\n details: result?.error\n ? stringify(result.error)\n : response.statusText,\n headers: response.headers,\n status: response.status,\n url,\n });\n continue;\n }\n if (!isHex(result)) {\n error = new OffchainLookupResponseMalformedError({\n result,\n url,\n });\n continue;\n }\n return result;\n }\n catch (err) {\n error = new HttpRequestError({\n body,\n details: err.message,\n url,\n });\n }\n }\n throw error;\n}\n//# sourceMappingURL=ccip.js.map","export function withTimeout(fn, { errorInstance = new Error('timed out'), timeout, signal, }) {\n return new Promise((resolve, reject) => {\n ;\n (async () => {\n let timeoutId;\n try {\n const controller = new AbortController();\n if (timeout > 0) {\n timeoutId = setTimeout(() => {\n if (signal) {\n controller.abort();\n }\n else {\n reject(errorInstance);\n }\n }, timeout); // need to cast because bun globals.d.ts overrides @types/node\n }\n resolve(await fn({ signal: controller?.signal || null }));\n }\n catch (err) {\n if (err?.name === 'AbortError')\n reject(errorInstance);\n reject(err);\n }\n finally {\n clearTimeout(timeoutId);\n }\n })();\n });\n}\n//# sourceMappingURL=withTimeout.js.map","function createIdStore() {\n return {\n current: 0,\n take() {\n return this.current++;\n },\n reset() {\n this.current = 0;\n },\n };\n}\nexport const idCache = /*#__PURE__*/ createIdStore();\n//# sourceMappingURL=id.js.map","import { HttpRequestError, TimeoutError, } from '../../errors/request.js';\nimport { withTimeout, } from '../promise/withTimeout.js';\nimport { stringify } from '../stringify.js';\nimport { idCache } from './id.js';\nexport function getHttpRpcClient(url, options = {}) {\n return {\n async request(params) {\n const { body, onRequest = options.onRequest, onResponse = options.onResponse, timeout = options.timeout ?? 10_000, } = params;\n const fetchOptions = {\n ...(options.fetchOptions ?? {}),\n ...(params.fetchOptions ?? {}),\n };\n const { headers, method, signal: signal_ } = fetchOptions;\n try {\n const response = await withTimeout(async ({ signal }) => {\n const init = {\n ...fetchOptions,\n body: Array.isArray(body)\n ? stringify(body.map((body) => ({\n jsonrpc: '2.0',\n id: body.id ?? idCache.take(),\n ...body,\n })))\n : stringify({\n jsonrpc: '2.0',\n id: body.id ?? idCache.take(),\n ...body,\n }),\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n method: method || 'POST',\n signal: signal_ || (timeout > 0 ? signal : null),\n };\n const request = new Request(url, init);\n const args = (await onRequest?.(request, init)) ?? { ...init, url };\n const response = await fetch(args.url ?? url, args);\n return response;\n }, {\n errorInstance: new TimeoutError({ body, url }),\n timeout,\n signal: true,\n });\n if (onResponse)\n await onResponse(response);\n let data;\n if (response.headers.get('Content-Type')?.startsWith('application/json'))\n data = await response.json();\n else {\n data = await response.text();\n try {\n data = JSON.parse(data || '{}');\n }\n catch (err) {\n if (response.ok)\n throw err;\n data = { error: data };\n }\n }\n if (!response.ok) {\n throw new HttpRequestError({\n body,\n details: stringify(data.error) || response.statusText,\n headers: response.headers,\n status: response.status,\n url,\n });\n }\n return data;\n }\n catch (err) {\n if (err instanceof HttpRequestError)\n throw err;\n if (err instanceof TimeoutError)\n throw err;\n throw new HttpRequestError({\n body,\n cause: err,\n url,\n });\n }\n },\n };\n}\n//# sourceMappingURL=http.js.map","import { BaseError } from './base.js';\nexport class InvalidDecimalNumberError extends BaseError {\n constructor({ value }) {\n super(`Number \\`${value}\\` is not a valid decimal number.`, {\n name: 'InvalidDecimalNumberError',\n });\n }\n}\n//# sourceMappingURL=unit.js.map","import { InvalidDecimalNumberError } from '../../errors/unit.js';\n/**\n * Multiplies a string representation of a number by a given exponent of base 10 (10exponent).\n *\n * - Docs: https://viem.sh/docs/utilities/parseUnits\n *\n * @example\n * import { parseUnits } from 'viem'\n *\n * parseUnits('420', 9)\n * // 420000000000n\n */\nexport function parseUnits(value, decimals) {\n if (!/^(-?)([0-9]*)\\.?([0-9]*)$/.test(value))\n throw new InvalidDecimalNumberError({ value });\n let [integer, fraction = '0'] = value.split('.');\n const negative = integer.startsWith('-');\n if (negative)\n integer = integer.slice(1);\n // trim trailing zeros.\n fraction = fraction.replace(/(0+)$/, '');\n // round off if the fraction is larger than the number of decimals.\n if (decimals === 0) {\n if (Math.round(Number(`.${fraction}`)) === 1)\n integer = `${BigInt(integer) + 1n}`;\n fraction = '';\n }\n else if (fraction.length > decimals) {\n const [left, unit, right] = [\n fraction.slice(0, decimals - 1),\n fraction.slice(decimals - 1, decimals),\n fraction.slice(decimals),\n ];\n const rounded = Math.round(Number(`${unit}.${right}`));\n if (rounded > 9)\n fraction = `${BigInt(left) + BigInt(1)}0`.padStart(left.length + 1, '0');\n else\n fraction = `${left}${rounded}`;\n if (fraction.length > decimals) {\n fraction = fraction.slice(1);\n integer = `${BigInt(integer) + 1n}`;\n }\n fraction = fraction.slice(0, decimals);\n }\n else {\n fraction = fraction.padEnd(decimals, '0');\n }\n return BigInt(`${negative ? '-' : ''}${integer}${fraction}`);\n}\n//# sourceMappingURL=parseUnits.js.map","import { BlockNotFoundError } from '../../errors/block.js';\nimport { TransactionNotFoundError, TransactionReceiptNotFoundError, WaitForTransactionReceiptTimeoutError, } from '../../errors/transaction.js';\nimport { getAction } from '../../utils/getAction.js';\nimport { observe } from '../../utils/observe.js';\nimport { withRetry, } from '../../utils/promise/withRetry.js';\nimport { stringify } from '../../utils/stringify.js';\nimport { getBlock } from './getBlock.js';\nimport { getTransaction, } from './getTransaction.js';\nimport { getTransactionReceipt, } from './getTransactionReceipt.js';\nimport { watchBlockNumber, } from './watchBlockNumber.js';\n/**\n * Waits for the [Transaction](https://viem.sh/docs/glossary/terms#transaction) to be included on a [Block](https://viem.sh/docs/glossary/terms#block) (one confirmation), and then returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms#transaction-receipt).\n *\n * - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt\n * - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/sending-transactions\n * - JSON-RPC Methods:\n * - Polls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt) on each block until it has been processed.\n * - If a Transaction has been replaced:\n * - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) and extracts the transactions\n * - Checks if one of the Transactions is a replacement\n * - If so, calls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt).\n *\n * The `waitForTransactionReceipt` action additionally supports Replacement detection (e.g. sped up Transactions).\n *\n * Transactions can be replaced when a user modifies their transaction in their wallet (to speed up or cancel). Transactions are replaced when they are sent from the same nonce.\n *\n * There are 3 types of Transaction Replacement reasons:\n *\n * - `repriced`: The gas price has been modified (e.g. different `maxFeePerGas`)\n * - `cancelled`: The Transaction has been cancelled (e.g. `value === 0n`)\n * - `replaced`: The Transaction has been replaced (e.g. different `value` or `data`)\n *\n * @param client - Client to use\n * @param parameters - {@link WaitForTransactionReceiptParameters}\n * @returns The transaction receipt. {@link WaitForTransactionReceiptReturnType}\n *\n * @example\n * import { createPublicClient, waitForTransactionReceipt, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const transactionReceipt = await waitForTransactionReceipt(client, {\n * hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',\n * })\n */\nexport async function waitForTransactionReceipt(client, { confirmations = 1, hash, onReplaced, pollingInterval = client.pollingInterval, retryCount = 6, retryDelay = ({ count }) => ~~(1 << count) * 200, // exponential backoff\ntimeout = 180_000, }) {\n const observerId = stringify(['waitForTransactionReceipt', client.uid, hash]);\n let transaction;\n let replacedTransaction;\n let receipt;\n let retrying = false;\n return new Promise((resolve, reject) => {\n if (timeout)\n setTimeout(() => reject(new WaitForTransactionReceiptTimeoutError({ hash })), timeout);\n const _unobserve = observe(observerId, { onReplaced, resolve, reject }, (emit) => {\n const _unwatch = getAction(client, watchBlockNumber, 'watchBlockNumber')({\n emitMissed: true,\n emitOnBegin: true,\n poll: true,\n pollingInterval,\n async onBlockNumber(blockNumber_) {\n const done = (fn) => {\n _unwatch();\n fn();\n _unobserve();\n };\n let blockNumber = blockNumber_;\n if (retrying)\n return;\n try {\n // If we already have a valid receipt, let's check if we have enough\n // confirmations. If we do, then we can resolve.\n if (receipt) {\n if (confirmations > 1 &&\n (!receipt.blockNumber ||\n blockNumber - receipt.blockNumber + 1n < confirmations))\n return;\n done(() => emit.resolve(receipt));\n return;\n }\n // Get the transaction to check if it's been replaced.\n // We need to retry as some RPC Providers may be slow to sync\n // up mined transactions.\n if (!transaction) {\n retrying = true;\n await withRetry(async () => {\n transaction = (await getAction(client, getTransaction, 'getTransaction')({ hash }));\n if (transaction.blockNumber)\n blockNumber = transaction.blockNumber;\n }, {\n delay: retryDelay,\n retryCount,\n });\n retrying = false;\n }\n // Get the receipt to check if it's been processed.\n receipt = await getAction(client, getTransactionReceipt, 'getTransactionReceipt')({ hash });\n // Check if we have enough confirmations. If not, continue polling.\n if (confirmations > 1 &&\n (!receipt.blockNumber ||\n blockNumber - receipt.blockNumber + 1n < confirmations))\n return;\n done(() => emit.resolve(receipt));\n }\n catch (err) {\n // If the receipt is not found, the transaction will be pending.\n // We need to check if it has potentially been replaced.\n if (err instanceof TransactionNotFoundError ||\n err instanceof TransactionReceiptNotFoundError) {\n if (!transaction) {\n retrying = false;\n return;\n }\n try {\n replacedTransaction = transaction;\n // Let's retrieve the transactions from the current block.\n // We need to retry as some RPC Providers may be slow to sync\n // up mined blocks.\n retrying = true;\n const block = await withRetry(() => getAction(client, getBlock, 'getBlock')({\n blockNumber,\n includeTransactions: true,\n }), {\n delay: retryDelay,\n retryCount,\n shouldRetry: ({ error }) => error instanceof BlockNotFoundError,\n });\n retrying = false;\n const replacementTransaction = block.transactions.find(({ from, nonce }) => from === replacedTransaction.from &&\n nonce === replacedTransaction.nonce);\n // If we couldn't find a replacement transaction, continue polling.\n if (!replacementTransaction)\n return;\n // If we found a replacement transaction, return it's receipt.\n receipt = await getAction(client, getTransactionReceipt, 'getTransactionReceipt')({\n hash: replacementTransaction.hash,\n });\n // Check if we have enough confirmations. If not, continue polling.\n if (confirmations > 1 &&\n (!receipt.blockNumber ||\n blockNumber - receipt.blockNumber + 1n < confirmations))\n return;\n let reason = 'replaced';\n if (replacementTransaction.to === replacedTransaction.to &&\n replacementTransaction.value === replacedTransaction.value) {\n reason = 'repriced';\n }\n else if (replacementTransaction.from === replacementTransaction.to &&\n replacementTransaction.value === 0n) {\n reason = 'cancelled';\n }\n done(() => {\n emit.onReplaced?.({\n reason,\n replacedTransaction: replacedTransaction,\n transaction: replacementTransaction,\n transactionReceipt: receipt,\n });\n emit.resolve(receipt);\n });\n }\n catch (err_) {\n done(() => emit.reject(err_));\n }\n }\n else {\n done(() => emit.reject(err));\n }\n }\n },\n });\n });\n });\n}\n//# sourceMappingURL=waitForTransactionReceipt.js.map","import { parseAccount, } from '../../accounts/utils/parseAccount.js';\nimport { AccountNotFoundError } from '../../errors/account.js';\nimport { stringToHex, toHex, } from '../../utils/encoding/toHex.js';\n/**\n * Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256(\"\\x19Ethereum Signed Message:\\n\" + len(message) + message))`.\n *\n * - Docs: https://viem.sh/docs/actions/wallet/signMessage\n * - JSON-RPC Methods:\n * - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data#personal-sign)\n * - Local Accounts: Signs locally. No JSON-RPC request.\n *\n * With the calculated signature, you can:\n * - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage) to verify the signature,\n * - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress) to recover the signing address from a signature.\n *\n * @param client - Client to use\n * @param parameters - {@link SignMessageParameters}\n * @returns The signed message. {@link SignMessageReturnType}\n *\n * @example\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { signMessage } from 'viem/wallet'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n * const signature = await signMessage(client, {\n * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',\n * message: 'hello world',\n * })\n *\n * @example\n * // Account Hoisting\n * import { createWalletClient, custom } from 'viem'\n * import { privateKeyToAccount } from 'viem/accounts'\n * import { mainnet } from 'viem/chains'\n * import { signMessage } from 'viem/wallet'\n *\n * const client = createWalletClient({\n * account: privateKeyToAccount('0x…'),\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n * const signature = await signMessage(client, {\n * message: 'hello world',\n * })\n */\nexport async function signMessage(client, { account: account_ = client.account, message, }) {\n if (!account_)\n throw new AccountNotFoundError({\n docsPath: '/docs/actions/wallet/signMessage',\n });\n const account = parseAccount(account_);\n if (account.signMessage)\n return account.signMessage({ message });\n const message_ = (() => {\n if (typeof message === 'string')\n return stringToHex(message);\n if (message.raw instanceof Uint8Array)\n return toHex(message.raw);\n return message.raw;\n })();\n return client.request({\n method: 'personal_sign',\n params: [message_, account.address],\n }, { retryCount: 0 });\n}\n//# sourceMappingURL=signMessage.js.map","import { parseAccount, } from '../../accounts/utils/parseAccount.js';\nimport { decodeFunctionResult, } from '../../utils/abi/decodeFunctionResult.js';\nimport { encodeFunctionData, } from '../../utils/abi/encodeFunctionData.js';\nimport { getContractError, } from '../../utils/errors/getContractError.js';\nimport { getAction } from '../../utils/getAction.js';\nimport { call } from './call.js';\n/**\n * Simulates/validates a contract interaction. This is useful for retrieving **return data** and **revert reasons** of contract write functions.\n *\n * - Docs: https://viem.sh/docs/contract/simulateContract\n * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/writing-to-contracts\n *\n * This function does not require gas to execute and _**does not**_ change the state of the blockchain. It is almost identical to [`readContract`](https://viem.sh/docs/contract/readContract), but also supports contract write functions.\n *\n * Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`call` action](https://viem.sh/docs/actions/public/call) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData).\n *\n * @param client - Client to use\n * @param parameters - {@link SimulateContractParameters}\n * @returns The simulation result and write request. {@link SimulateContractReturnType}\n *\n * @example\n * import { createPublicClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { simulateContract } from 'viem/contract'\n *\n * const client = createPublicClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const result = await simulateContract(client, {\n * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',\n * abi: parseAbi(['function mint(uint32) view returns (uint32)']),\n * functionName: 'mint',\n * args: ['69420'],\n * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',\n * })\n */\nexport async function simulateContract(client, parameters) {\n const { abi, address, args, dataSuffix, functionName, ...callRequest } = parameters;\n const account = callRequest.account\n ? parseAccount(callRequest.account)\n : client.account;\n const calldata = encodeFunctionData({ abi, args, functionName });\n try {\n const { data } = await getAction(client, call, 'call')({\n batch: false,\n data: `${calldata}${dataSuffix ? dataSuffix.replace('0x', '') : ''}`,\n to: address,\n ...callRequest,\n account,\n });\n const result = decodeFunctionResult({\n abi,\n args,\n functionName,\n data: data || '0x',\n });\n const minimizedAbi = abi.filter((abiItem) => 'name' in abiItem && abiItem.name === parameters.functionName);\n return {\n result,\n request: {\n abi: minimizedAbi,\n address,\n args,\n dataSuffix,\n functionName,\n ...callRequest,\n account,\n },\n };\n }\n catch (error) {\n throw getContractError(error, {\n abi,\n address,\n args,\n docsPath: '/docs/contract/simulateContract',\n functionName,\n sender: account?.address,\n });\n }\n}\n//# sourceMappingURL=simulateContract.js.map","import { hash as assertHash, bytes as assertBytes, exists as assertExists } from './_assert.js';\nimport { Hash, toBytes } from './utils.js';\n// HMAC (RFC 2104)\nexport class HMAC extends Hash {\n constructor(hash, _key) {\n super();\n this.finished = false;\n this.destroyed = false;\n assertHash(hash);\n const key = toBytes(_key);\n this.iHash = hash.create();\n if (typeof this.iHash.update !== 'function')\n throw new Error('Expected instance of class which extends utils.Hash');\n this.blockLen = this.iHash.blockLen;\n this.outputLen = this.iHash.outputLen;\n const blockLen = this.blockLen;\n const pad = new Uint8Array(blockLen);\n // blockLen can be bigger than outputLen\n pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36;\n this.iHash.update(pad);\n // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone\n this.oHash = hash.create();\n // Undo internal XOR && apply outer XOR\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36 ^ 0x5c;\n this.oHash.update(pad);\n pad.fill(0);\n }\n update(buf) {\n assertExists(this);\n this.iHash.update(buf);\n return this;\n }\n digestInto(out) {\n assertExists(this);\n assertBytes(out, this.outputLen);\n this.finished = true;\n this.iHash.digestInto(out);\n this.oHash.update(out);\n this.oHash.digestInto(out);\n this.destroy();\n }\n digest() {\n const out = new Uint8Array(this.oHash.outputLen);\n this.digestInto(out);\n return out;\n }\n _cloneInto(to) {\n // Create new instance without calling constructor since key already in state and we don't know it.\n to || (to = Object.create(Object.getPrototypeOf(this), {}));\n const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;\n to = to;\n to.finished = finished;\n to.destroyed = destroyed;\n to.blockLen = blockLen;\n to.outputLen = outputLen;\n to.oHash = oHash._cloneInto(to.oHash);\n to.iHash = iHash._cloneInto(to.iHash);\n return to;\n }\n destroy() {\n this.destroyed = true;\n this.oHash.destroy();\n this.iHash.destroy();\n }\n}\n/**\n * HMAC: RFC2104 message authentication code.\n * @param hash - function that would be used e.g. sha256\n * @param key - message key\n * @param message - message data\n * @example\n * import { hmac } from '@noble/hashes/hmac';\n * import { sha256 } from '@noble/hashes/sha2';\n * const mac1 = hmac(sha256, 'key', 'message');\n */\nexport const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();\nhmac.create = (hash, key) => new HMAC(hash, key);\n//# sourceMappingURL=hmac.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// 100 lines of code in the file are duplicated from noble-hashes (utils).\n// This is OK: `abstract` directory does not use noble-hashes.\n// User may opt-in into using different hashing library. This way, noble-hashes\n// won't be included into their bundle.\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nconst _2n = /* @__PURE__ */ BigInt(2);\nexport function isBytes(a) {\n return (a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array'));\n}\nexport function abytes(item) {\n if (!isBytes(item))\n throw new Error('Uint8Array expected');\n}\nexport function abool(title, value) {\n if (typeof value !== 'boolean')\n throw new Error(`${title} must be valid boolean, got \"${value}\".`);\n}\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n abytes(bytes);\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\nexport function numberToHexUnpadded(num) {\n const hex = num.toString(16);\n return hex.length & 1 ? `0${hex}` : hex;\n}\nexport function hexToNumber(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n // Big Endian\n return BigInt(hex === '' ? '0' : `0x${hex}`);\n}\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 };\nfunction asciiToBase16(char) {\n if (char >= asciis._0 && char <= asciis._9)\n return char - asciis._0;\n if (char >= asciis._A && char <= asciis._F)\n return char - (asciis._A - 10);\n if (char >= asciis._a && char <= asciis._f)\n return char - (asciis._a - 10);\n return;\n}\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2)\n throw new Error('padded hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2;\n }\n return array;\n}\n// BE: Big Endian, LE: Little Endian\nexport function bytesToNumberBE(bytes) {\n return hexToNumber(bytesToHex(bytes));\n}\nexport function bytesToNumberLE(bytes) {\n abytes(bytes);\n return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));\n}\nexport function numberToBytesBE(n, len) {\n return hexToBytes(n.toString(16).padStart(len * 2, '0'));\n}\nexport function numberToBytesLE(n, len) {\n return numberToBytesBE(n, len).reverse();\n}\n// Unpadded, rarely used\nexport function numberToVarBytesBE(n) {\n return hexToBytes(numberToHexUnpadded(n));\n}\n/**\n * Takes hex string or Uint8Array, converts to Uint8Array.\n * Validates output length.\n * Will throw error for other types.\n * @param title descriptive title for an error e.g. 'private key'\n * @param hex hex string or Uint8Array\n * @param expectedLength optional, will compare to result array's length\n * @returns\n */\nexport function ensureBytes(title, hex, expectedLength) {\n let res;\n if (typeof hex === 'string') {\n try {\n res = hexToBytes(hex);\n }\n catch (e) {\n throw new Error(`${title} must be valid hex string, got \"${hex}\". Cause: ${e}`);\n }\n }\n else if (isBytes(hex)) {\n // Uint8Array.from() instead of hash.slice() because node.js Buffer\n // is instance of Uint8Array, and its slice() creates **mutable** copy\n res = Uint8Array.from(hex);\n }\n else {\n throw new Error(`${title} must be hex string or Uint8Array`);\n }\n const len = res.length;\n if (typeof expectedLength === 'number' && len !== expectedLength)\n throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);\n return res;\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays) {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n// Compares 2 u8a-s in kinda constant time\nexport function equalBytes(a, b) {\n if (a.length !== b.length)\n return false;\n let diff = 0;\n for (let i = 0; i < a.length; i++)\n diff |= a[i] ^ b[i];\n return diff === 0;\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n// Is positive bigint\nconst isPosBig = (n) => typeof n === 'bigint' && _0n <= n;\nexport function inRange(n, min, max) {\n return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;\n}\n/**\n * Asserts min <= n < max. NOTE: It's < max and not <= max.\n * @example\n * aInRange('x', x, 1n, 256n); // would assume x is in (1n..255n)\n */\nexport function aInRange(title, n, min, max) {\n // Why min <= n < max and not a (min < n < max) OR b (min <= n <= max)?\n // consider P=256n, min=0n, max=P\n // - a for min=0 would require -1: `inRange('x', x, -1n, P)`\n // - b would commonly require subtraction: `inRange('x', x, 0n, P - 1n)`\n // - our way is the cleanest: `inRange('x', x, 0n, P)\n if (!inRange(n, min, max))\n throw new Error(`expected valid ${title}: ${min} <= n < ${max}, got ${typeof n} ${n}`);\n}\n// Bit operations\n/**\n * Calculates amount of bits in a bigint.\n * Same as `n.toString(2).length`\n */\nexport function bitLen(n) {\n let len;\n for (len = 0; n > _0n; n >>= _1n, len += 1)\n ;\n return len;\n}\n/**\n * Gets single bit at position.\n * NOTE: first bit position is 0 (same as arrays)\n * Same as `!!+Array.from(n.toString(2)).reverse()[pos]`\n */\nexport function bitGet(n, pos) {\n return (n >> BigInt(pos)) & _1n;\n}\n/**\n * Sets single bit at position.\n */\nexport function bitSet(n, pos, value) {\n return n | ((value ? _1n : _0n) << BigInt(pos));\n}\n/**\n * Calculate mask for N bits. Not using ** operator with bigints because of old engines.\n * Same as BigInt(`0b${Array(i).fill('1').join('')}`)\n */\nexport const bitMask = (n) => (_2n << BigInt(n - 1)) - _1n;\n// DRBG\nconst u8n = (data) => new Uint8Array(data); // creates Uint8Array\nconst u8fr = (arr) => Uint8Array.from(arr); // another shortcut\n/**\n * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n * @returns function that will call DRBG until 2nd arg returns something meaningful\n * @example\n * const drbg = createHmacDRBG(32, 32, hmac);\n * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined\n */\nexport function createHmacDrbg(hashLen, qByteLen, hmacFn) {\n if (typeof hashLen !== 'number' || hashLen < 2)\n throw new Error('hashLen must be a number');\n if (typeof qByteLen !== 'number' || qByteLen < 2)\n throw new Error('qByteLen must be a number');\n if (typeof hmacFn !== 'function')\n throw new Error('hmacFn must be a function');\n // Step B, Step C: set hashLen to 8*ceil(hlen/8)\n let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same\n let i = 0; // Iterations counter, will throw when over 1000\n const reset = () => {\n v.fill(1);\n k.fill(0);\n i = 0;\n };\n const h = (...b) => hmacFn(k, v, ...b); // hmac(k)(v, ...values)\n const reseed = (seed = u8n()) => {\n // HMAC-DRBG reseed() function. Steps D-G\n k = h(u8fr([0x00]), seed); // k = hmac(k || v || 0x00 || seed)\n v = h(); // v = hmac(k || v)\n if (seed.length === 0)\n return;\n k = h(u8fr([0x01]), seed); // k = hmac(k || v || 0x01 || seed)\n v = h(); // v = hmac(k || v)\n };\n const gen = () => {\n // HMAC-DRBG generate() function\n if (i++ >= 1000)\n throw new Error('drbg: tried 1000 values');\n let len = 0;\n const out = [];\n while (len < qByteLen) {\n v = h();\n const sl = v.slice();\n out.push(sl);\n len += v.length;\n }\n return concatBytes(...out);\n };\n const genUntil = (seed, pred) => {\n reset();\n reseed(seed); // Steps D-G\n let res = undefined; // Step H: grind until k is in [1..n-1]\n while (!(res = pred(gen())))\n reseed();\n reset();\n return res;\n };\n return genUntil;\n}\n// Validating curves and fields\nconst validatorFns = {\n bigint: (val) => typeof val === 'bigint',\n function: (val) => typeof val === 'function',\n boolean: (val) => typeof val === 'boolean',\n string: (val) => typeof val === 'string',\n stringOrUint8Array: (val) => typeof val === 'string' || isBytes(val),\n isSafeInteger: (val) => Number.isSafeInteger(val),\n array: (val) => Array.isArray(val),\n field: (val, object) => object.Fp.isValid(val),\n hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen),\n};\n// type Record = { [P in K]: T; }\nexport function validateObject(object, validators, optValidators = {}) {\n const checkField = (fieldName, type, isOptional) => {\n const checkVal = validatorFns[type];\n if (typeof checkVal !== 'function')\n throw new Error(`Invalid validator \"${type}\", expected function`);\n const val = object[fieldName];\n if (isOptional && val === undefined)\n return;\n if (!checkVal(val, object)) {\n throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`);\n }\n };\n for (const [fieldName, type] of Object.entries(validators))\n checkField(fieldName, type, false);\n for (const [fieldName, type] of Object.entries(optValidators))\n checkField(fieldName, type, true);\n return object;\n}\n// validate type tests\n// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 };\n// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok!\n// // Should fail type-check\n// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' });\n// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' });\n// const z3 = validateObject(o, { test: 'boolean', z: 'bug' });\n// const z4 = validateObject(o, { a: 'boolean', z: 'bug' });\n/**\n * throws not implemented error\n */\nexport const notImplemented = () => {\n throw new Error('not implemented');\n};\n/**\n * Memoizes (caches) computation result.\n * Uses WeakMap: the value is going auto-cleaned by GC after last reference is removed.\n */\nexport function memoized(fn) {\n const map = new WeakMap();\n return (arg, ...args) => {\n const val = map.get(arg);\n if (val !== undefined)\n return val;\n const computed = fn(arg, ...args);\n map.set(arg, computed);\n return computed;\n };\n}\n//# sourceMappingURL=utils.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Utilities for modular arithmetics and finite fields\nimport { bitMask, bytesToNumberBE, bytesToNumberLE, ensureBytes, numberToBytesBE, numberToBytesLE, validateObject, } from './utils.js';\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3);\n// prettier-ignore\nconst _4n = BigInt(4), _5n = BigInt(5), _8n = BigInt(8);\n// prettier-ignore\nconst _9n = BigInt(9), _16n = BigInt(16);\n// Calculates a modulo b\nexport function mod(a, b) {\n const result = a % b;\n return result >= _0n ? result : b + result;\n}\n/**\n * Efficiently raise num to power and do modular division.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n * @example\n * pow(2n, 6n, 11n) // 64n % 11n == 9n\n */\n// TODO: use field version && remove\nexport function pow(num, power, modulo) {\n if (modulo <= _0n || power < _0n)\n throw new Error('Expected power/modulo > 0');\n if (modulo === _1n)\n return _0n;\n let res = _1n;\n while (power > _0n) {\n if (power & _1n)\n res = (res * num) % modulo;\n num = (num * num) % modulo;\n power >>= _1n;\n }\n return res;\n}\n// Does x ^ (2 ^ power) mod p. pow2(30, 4) == 30 ^ (2 ^ 4)\nexport function pow2(x, power, modulo) {\n let res = x;\n while (power-- > _0n) {\n res *= res;\n res %= modulo;\n }\n return res;\n}\n// Inverses number over modulo\nexport function invert(number, modulo) {\n if (number === _0n || modulo <= _0n) {\n throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`);\n }\n // Euclidean GCD https://brilliant.org/wiki/extended-euclidean-algorithm/\n // Fermat's little theorem \"CT-like\" version inv(n) = n^(m-2) mod m is 30x slower.\n let a = mod(number, modulo);\n let b = modulo;\n // prettier-ignore\n let x = _0n, y = _1n, u = _1n, v = _0n;\n while (a !== _0n) {\n // JIT applies optimization if those two lines follow each other\n const q = b / a;\n const r = b % a;\n const m = x - u * q;\n const n = y - v * q;\n // prettier-ignore\n b = a, a = r, x = u, y = v, u = m, v = n;\n }\n const gcd = b;\n if (gcd !== _1n)\n throw new Error('invert: does not exist');\n return mod(x, modulo);\n}\n/**\n * Tonelli-Shanks square root search algorithm.\n * 1. https://eprint.iacr.org/2012/685.pdf (page 12)\n * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks\n * Will start an infinite loop if field order P is not prime.\n * @param P field order\n * @returns function that takes field Fp (created from P) and number n\n */\nexport function tonelliShanks(P) {\n // Legendre constant: used to calculate Legendre symbol (a | p),\n // which denotes the value of a^((p-1)/2) (mod p).\n // (a | p) ≡ 1 if a is a square (mod p)\n // (a | p) ≡ -1 if a is not a square (mod p)\n // (a | p) ≡ 0 if a ≡ 0 (mod p)\n const legendreC = (P - _1n) / _2n;\n let Q, S, Z;\n // Step 1: By factoring out powers of 2 from p - 1,\n // find q and s such that p - 1 = q*(2^s) with q odd\n for (Q = P - _1n, S = 0; Q % _2n === _0n; Q /= _2n, S++)\n ;\n // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq\n for (Z = _2n; Z < P && pow(Z, legendreC, P) !== P - _1n; Z++)\n ;\n // Fast-path\n if (S === 1) {\n const p1div4 = (P + _1n) / _4n;\n return function tonelliFast(Fp, n) {\n const root = Fp.pow(n, p1div4);\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // Slow-path\n const Q1div2 = (Q + _1n) / _2n;\n return function tonelliSlow(Fp, n) {\n // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1\n if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE))\n throw new Error('Cannot find square root');\n let r = S;\n // TODO: will fail at Fp2/etc\n let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b\n let x = Fp.pow(n, Q1div2); // first guess at the square root\n let b = Fp.pow(n, Q); // first guess at the fudge factor\n while (!Fp.eql(b, Fp.ONE)) {\n if (Fp.eql(b, Fp.ZERO))\n return Fp.ZERO; // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm (4. If t = 0, return r = 0)\n // Find m such b^(2^m)==1\n let m = 1;\n for (let t2 = Fp.sqr(b); m < r; m++) {\n if (Fp.eql(t2, Fp.ONE))\n break;\n t2 = Fp.sqr(t2); // t2 *= t2\n }\n // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, otherwise there will be overflow\n const ge = Fp.pow(g, _1n << BigInt(r - m - 1)); // ge = 2^(r-m-1)\n g = Fp.sqr(ge); // g = ge * ge\n x = Fp.mul(x, ge); // x *= ge\n b = Fp.mul(b, g); // b *= g\n r = m;\n }\n return x;\n };\n}\nexport function FpSqrt(P) {\n // NOTE: different algorithms can give different roots, it is up to user to decide which one they want.\n // For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve).\n // P ≡ 3 (mod 4)\n // √n = n^((P+1)/4)\n if (P % _4n === _3n) {\n // Not all roots possible!\n // const ORDER =\n // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn;\n // const NUM = 72057594037927816n;\n const p1div4 = (P + _1n) / _4n;\n return function sqrt3mod4(Fp, n) {\n const root = Fp.pow(n, p1div4);\n // Throw if root**2 != n\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10)\n if (P % _8n === _5n) {\n const c1 = (P - _5n) / _8n;\n return function sqrt5mod8(Fp, n) {\n const n2 = Fp.mul(n, _2n);\n const v = Fp.pow(n2, c1);\n const nv = Fp.mul(n, v);\n const i = Fp.mul(Fp.mul(nv, _2n), v);\n const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n return root;\n };\n }\n // P ≡ 9 (mod 16)\n if (P % _16n === _9n) {\n // NOTE: tonelli is too slow for bls-Fp2 calculations even on start\n // Means we cannot use sqrt for constants at all!\n //\n // const c1 = Fp.sqrt(Fp.negate(Fp.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F\n // const c2 = Fp.sqrt(c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F\n // const c3 = Fp.sqrt(Fp.negate(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F\n // const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic\n // sqrt = (x) => {\n // let tv1 = Fp.pow(x, c4); // 1. tv1 = x^c4\n // let tv2 = Fp.mul(c1, tv1); // 2. tv2 = c1 * tv1\n // const tv3 = Fp.mul(c2, tv1); // 3. tv3 = c2 * tv1\n // let tv4 = Fp.mul(c3, tv1); // 4. tv4 = c3 * tv1\n // const e1 = Fp.equals(Fp.square(tv2), x); // 5. e1 = (tv2^2) == x\n // const e2 = Fp.equals(Fp.square(tv3), x); // 6. e2 = (tv3^2) == x\n // tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x\n // tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x\n // const e3 = Fp.equals(Fp.square(tv2), x); // 9. e3 = (tv2^2) == x\n // return Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select the sqrt from tv1 and tv2\n // }\n }\n // Other cases: Tonelli-Shanks algorithm\n return tonelliShanks(P);\n}\n// Little-endian check for first LE bit (last BE bit);\nexport const isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n) === _1n;\n// prettier-ignore\nconst FIELD_FIELDS = [\n 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr',\n 'eql', 'add', 'sub', 'mul', 'pow', 'div',\n 'addN', 'subN', 'mulN', 'sqrN'\n];\nexport function validateField(field) {\n const initial = {\n ORDER: 'bigint',\n MASK: 'bigint',\n BYTES: 'isSafeInteger',\n BITS: 'isSafeInteger',\n };\n const opts = FIELD_FIELDS.reduce((map, val) => {\n map[val] = 'function';\n return map;\n }, initial);\n return validateObject(field, opts);\n}\n// Generic field functions\n/**\n * Same as `pow` but for Fp: non-constant-time.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n */\nexport function FpPow(f, num, power) {\n // Should have same speed as pow for bigints\n // TODO: benchmark!\n if (power < _0n)\n throw new Error('Expected power > 0');\n if (power === _0n)\n return f.ONE;\n if (power === _1n)\n return num;\n let p = f.ONE;\n let d = num;\n while (power > _0n) {\n if (power & _1n)\n p = f.mul(p, d);\n d = f.sqr(d);\n power >>= _1n;\n }\n return p;\n}\n/**\n * Efficiently invert an array of Field elements.\n * `inv(0)` will return `undefined` here: make sure to throw an error.\n */\nexport function FpInvertBatch(f, nums) {\n const tmp = new Array(nums.length);\n // Walk from first to last, multiply them by each other MOD p\n const lastMultiplied = nums.reduce((acc, num, i) => {\n if (f.is0(num))\n return acc;\n tmp[i] = acc;\n return f.mul(acc, num);\n }, f.ONE);\n // Invert last element\n const inverted = f.inv(lastMultiplied);\n // Walk from last to first, multiply them by inverted each other MOD p\n nums.reduceRight((acc, num, i) => {\n if (f.is0(num))\n return acc;\n tmp[i] = f.mul(acc, tmp[i]);\n return f.mul(acc, num);\n }, inverted);\n return tmp;\n}\nexport function FpDiv(f, lhs, rhs) {\n return f.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, f.ORDER) : f.inv(rhs));\n}\nexport function FpLegendre(order) {\n // (a | p) ≡ 1 if a is a square (mod p), quadratic residue\n // (a | p) ≡ -1 if a is not a square (mod p), quadratic non residue\n // (a | p) ≡ 0 if a ≡ 0 (mod p)\n const legendreConst = (order - _1n) / _2n; // Integer arithmetic\n return (f, x) => f.pow(x, legendreConst);\n}\n// This function returns True whenever the value x is a square in the field F.\nexport function FpIsSquare(f) {\n const legendre = FpLegendre(f.ORDER);\n return (x) => {\n const p = legendre(f, x);\n return f.eql(p, f.ZERO) || f.eql(p, f.ONE);\n };\n}\n// CURVE.n lengths\nexport function nLength(n, nBitLength) {\n // Bit size, byte size of CURVE.n\n const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length;\n const nByteLength = Math.ceil(_nBitLength / 8);\n return { nBitLength: _nBitLength, nByteLength };\n}\n/**\n * Initializes a finite field over prime. **Non-primes are not supported.**\n * Do not init in loop: slow. Very fragile: always run a benchmark on a change.\n * Major performance optimizations:\n * * a) denormalized operations like mulN instead of mul\n * * b) same object shape: never add or remove keys\n * * c) Object.freeze\n * NOTE: operations don't check 'isValid' for all elements for performance reasons,\n * it is caller responsibility to check this.\n * This is low-level code, please make sure you know what you doing.\n * @param ORDER prime positive bigint\n * @param bitLen how many bits the field consumes\n * @param isLE (def: false) if encoding / decoding should be in little-endian\n * @param redef optional faster redefinitions of sqrt and other methods\n */\nexport function Field(ORDER, bitLen, isLE = false, redef = {}) {\n if (ORDER <= _0n)\n throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);\n const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen);\n if (BYTES > 2048)\n throw new Error('Field lengths over 2048 bytes are not supported');\n const sqrtP = FpSqrt(ORDER);\n const f = Object.freeze({\n ORDER,\n BITS,\n BYTES,\n MASK: bitMask(BITS),\n ZERO: _0n,\n ONE: _1n,\n create: (num) => mod(num, ORDER),\n isValid: (num) => {\n if (typeof num !== 'bigint')\n throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);\n return _0n <= num && num < ORDER; // 0 is valid element, but it's not invertible\n },\n is0: (num) => num === _0n,\n isOdd: (num) => (num & _1n) === _1n,\n neg: (num) => mod(-num, ORDER),\n eql: (lhs, rhs) => lhs === rhs,\n sqr: (num) => mod(num * num, ORDER),\n add: (lhs, rhs) => mod(lhs + rhs, ORDER),\n sub: (lhs, rhs) => mod(lhs - rhs, ORDER),\n mul: (lhs, rhs) => mod(lhs * rhs, ORDER),\n pow: (num, power) => FpPow(f, num, power),\n div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER),\n // Same as above, but doesn't normalize\n sqrN: (num) => num * num,\n addN: (lhs, rhs) => lhs + rhs,\n subN: (lhs, rhs) => lhs - rhs,\n mulN: (lhs, rhs) => lhs * rhs,\n inv: (num) => invert(num, ORDER),\n sqrt: redef.sqrt || ((n) => sqrtP(f, n)),\n invertBatch: (lst) => FpInvertBatch(f, lst),\n // TODO: do we really need constant cmov?\n // We don't have const-time bigints anyway, so probably will be not very useful\n cmov: (a, b, c) => (c ? b : a),\n toBytes: (num) => (isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES)),\n fromBytes: (bytes) => {\n if (bytes.length !== BYTES)\n throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes.length}`);\n return isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes);\n },\n });\n return Object.freeze(f);\n}\nexport function FpSqrtOdd(Fp, elm) {\n if (!Fp.isOdd)\n throw new Error(`Field doesn't have isOdd`);\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? root : Fp.neg(root);\n}\nexport function FpSqrtEven(Fp, elm) {\n if (!Fp.isOdd)\n throw new Error(`Field doesn't have isOdd`);\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? Fp.neg(root) : root;\n}\n/**\n * \"Constant-time\" private key generation utility.\n * Same as mapKeyToField, but accepts less bytes (40 instead of 48 for 32-byte field).\n * Which makes it slightly more biased, less secure.\n * @deprecated use mapKeyToField instead\n */\nexport function hashToPrivateScalar(hash, groupOrder, isLE = false) {\n hash = ensureBytes('privateHash', hash);\n const hashLen = hash.length;\n const minLen = nLength(groupOrder).nByteLength + 8;\n if (minLen < 24 || hashLen < minLen || hashLen > 1024)\n throw new Error(`hashToPrivateScalar: expected ${minLen}-1024 bytes of input, got ${hashLen}`);\n const num = isLE ? bytesToNumberLE(hash) : bytesToNumberBE(hash);\n return mod(num, groupOrder - _1n) + _1n;\n}\n/**\n * Returns total number of bytes consumed by the field element.\n * For example, 32 bytes for usual 256-bit weierstrass curve.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of field\n */\nexport function getFieldBytesLength(fieldOrder) {\n if (typeof fieldOrder !== 'bigint')\n throw new Error('field order must be bigint');\n const bitLength = fieldOrder.toString(2).length;\n return Math.ceil(bitLength / 8);\n}\n/**\n * Returns minimal amount of bytes that can be safely reduced\n * by field order.\n * Should be 2^-128 for 128-bit curve such as P256.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of target hash\n */\nexport function getMinHashLength(fieldOrder) {\n const length = getFieldBytesLength(fieldOrder);\n return length + Math.ceil(length / 2);\n}\n/**\n * \"Constant-time\" private key generation utility.\n * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF\n * and convert them into private scalar, with the modulo bias being negligible.\n * Needs at least 48 bytes of input for 32-byte private key.\n * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/\n * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final\n * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5\n * @param hash hash output from SHA3 or a similar function\n * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n)\n * @param isLE interpret hash bytes as LE num\n * @returns valid private scalar\n */\nexport function mapHashToField(key, fieldOrder, isLE = false) {\n const len = key.length;\n const fieldLen = getFieldBytesLength(fieldOrder);\n const minLen = getMinHashLength(fieldOrder);\n // No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings.\n if (len < 16 || len < minLen || len > 1024)\n throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);\n const num = isLE ? bytesToNumberBE(key) : bytesToNumberLE(key);\n // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0\n const reduced = mod(num, fieldOrder - _1n) + _1n;\n return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);\n}\n//# sourceMappingURL=modular.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Abelian group utilities\nimport { validateField, nLength } from './modular.js';\nimport { validateObject, bitLen } from './utils.js';\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\n// Since points in different groups cannot be equal (different object constructor),\n// we can have single place to store precomputes\nconst pointPrecomputes = new WeakMap();\nconst pointWindowSizes = new WeakMap(); // This allows use make points immutable (nothing changes inside)\n// Elliptic curve multiplication of Point by scalar. Fragile.\n// Scalars should always be less than curve order: this should be checked inside of a curve itself.\n// Creates precomputation tables for fast multiplication:\n// - private scalar is split by fixed size windows of W bits\n// - every window point is collected from window's table & added to accumulator\n// - since windows are different, same point inside tables won't be accessed more than once per calc\n// - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar)\n// - +1 window is neccessary for wNAF\n// - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication\n// TODO: Research returning 2d JS array of windows, instead of a single window. This would allow\n// windows to be in different memory locations\nexport function wNAF(c, bits) {\n const constTimeNegate = (condition, item) => {\n const neg = item.negate();\n return condition ? neg : item;\n };\n const validateW = (W) => {\n if (!Number.isSafeInteger(W) || W <= 0 || W > bits)\n throw new Error(`Wrong window size=${W}, should be [1..${bits}]`);\n };\n const opts = (W) => {\n validateW(W);\n const windows = Math.ceil(bits / W) + 1; // +1, because\n const windowSize = 2 ** (W - 1); // -1 because we skip zero\n return { windows, windowSize };\n };\n return {\n constTimeNegate,\n // non-const time multiplication ladder\n unsafeLadder(elm, n) {\n let p = c.ZERO;\n let d = elm;\n while (n > _0n) {\n if (n & _1n)\n p = p.add(d);\n d = d.double();\n n >>= _1n;\n }\n return p;\n },\n /**\n * Creates a wNAF precomputation window. Used for caching.\n * Default window size is set by `utils.precompute()` and is equal to 8.\n * Number of precomputed points depends on the curve size:\n * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:\n * - 𝑊 is the window size\n * - 𝑛 is the bitlength of the curve order.\n * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.\n * @returns precomputed point tables flattened to a single array\n */\n precomputeWindow(elm, W) {\n const { windows, windowSize } = opts(W);\n const points = [];\n let p = elm;\n let base = p;\n for (let window = 0; window < windows; window++) {\n base = p;\n points.push(base);\n // =1, because we skip zero\n for (let i = 1; i < windowSize; i++) {\n base = base.add(p);\n points.push(base);\n }\n p = base.double();\n }\n return points;\n },\n /**\n * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.\n * @param W window size\n * @param precomputes precomputed tables\n * @param n scalar (we don't check here, but should be less than curve order)\n * @returns real and fake (for const-time) points\n */\n wNAF(W, precomputes, n) {\n // TODO: maybe check that scalar is less than group order? wNAF behavious is undefined otherwise\n // But need to carefully remove other checks before wNAF. ORDER == bits here\n const { windows, windowSize } = opts(W);\n let p = c.ZERO;\n let f = c.BASE;\n const mask = BigInt(2 ** W - 1); // Create mask with W ones: 0b1111 for W=4 etc.\n const maxNumber = 2 ** W;\n const shiftBy = BigInt(W);\n for (let window = 0; window < windows; window++) {\n const offset = window * windowSize;\n // Extract W bits.\n let wbits = Number(n & mask);\n // Shift number by W bits.\n n >>= shiftBy;\n // If the bits are bigger than max size, we'll split those.\n // +224 => 256 - 32\n if (wbits > windowSize) {\n wbits -= maxNumber;\n n += _1n;\n }\n // This code was first written with assumption that 'f' and 'p' will never be infinity point:\n // since each addition is multiplied by 2 ** W, it cannot cancel each other. However,\n // there is negate now: it is possible that negated element from low value\n // would be the same as high element, which will create carry into next window.\n // It's not obvious how this can fail, but still worth investigating later.\n // Check if we're onto Zero point.\n // Add random point inside current window to f.\n const offset1 = offset;\n const offset2 = offset + Math.abs(wbits) - 1; // -1 because we skip zero\n const cond1 = window % 2 !== 0;\n const cond2 = wbits < 0;\n if (wbits === 0) {\n // The most important part for const-time getPublicKey\n f = f.add(constTimeNegate(cond1, precomputes[offset1]));\n }\n else {\n p = p.add(constTimeNegate(cond2, precomputes[offset2]));\n }\n }\n // JIT-compiler should not eliminate f here, since it will later be used in normalizeZ()\n // Even if the variable is still unused, there are some checks which will\n // throw an exception, so compiler needs to prove they won't happen, which is hard.\n // At this point there is a way to F be infinity-point even if p is not,\n // which makes it less const-time: around 1 bigint multiply.\n return { p, f };\n },\n wNAFCached(P, n, transform) {\n const W = pointWindowSizes.get(P) || 1;\n // Calculate precomputes on a first run, reuse them after\n let comp = pointPrecomputes.get(P);\n if (!comp) {\n comp = this.precomputeWindow(P, W);\n if (W !== 1)\n pointPrecomputes.set(P, transform(comp));\n }\n return this.wNAF(W, comp, n);\n },\n // We calculate precomputes for elliptic curve point multiplication\n // using windowed method. This specifies window size and\n // stores precomputed values. Usually only base point would be precomputed.\n setWindowSize(P, W) {\n validateW(W);\n pointWindowSizes.set(P, W);\n pointPrecomputes.delete(P);\n },\n };\n}\n/**\n * Pippenger algorithm for multi-scalar multiplication (MSM).\n * MSM is basically (Pa + Qb + Rc + ...).\n * 30x faster vs naive addition on L=4096, 10x faster with precomputes.\n * For N=254bit, L=1, it does: 1024 ADD + 254 DBL. For L=5: 1536 ADD + 254 DBL.\n * Algorithmically constant-time (for same L), even when 1 point + scalar, or when scalar = 0.\n * @param c Curve Point constructor\n * @param field field over CURVE.N - important that it's not over CURVE.P\n * @param points array of L curve points\n * @param scalars array of L scalars (aka private keys / bigints)\n */\nexport function pippenger(c, field, points, scalars) {\n // If we split scalars by some window (let's say 8 bits), every chunk will only\n // take 256 buckets even if there are 4096 scalars, also re-uses double.\n // TODO:\n // - https://eprint.iacr.org/2024/750.pdf\n // - https://tches.iacr.org/index.php/TCHES/article/view/10287\n // 0 is accepted in scalars\n if (!Array.isArray(points) || !Array.isArray(scalars) || scalars.length !== points.length)\n throw new Error('arrays of points and scalars must have equal length');\n scalars.forEach((s, i) => {\n if (!field.isValid(s))\n throw new Error(`wrong scalar at index ${i}`);\n });\n points.forEach((p, i) => {\n if (!(p instanceof c))\n throw new Error(`wrong point at index ${i}`);\n });\n const wbits = bitLen(BigInt(points.length));\n const windowSize = wbits > 12 ? wbits - 3 : wbits > 4 ? wbits - 2 : wbits ? 2 : 1; // in bits\n const MASK = (1 << windowSize) - 1;\n const buckets = new Array(MASK + 1).fill(c.ZERO); // +1 for zero array\n const lastBits = Math.floor((field.BITS - 1) / windowSize) * windowSize;\n let sum = c.ZERO;\n for (let i = lastBits; i >= 0; i -= windowSize) {\n buckets.fill(c.ZERO);\n for (let j = 0; j < scalars.length; j++) {\n const scalar = scalars[j];\n const wbits = Number((scalar >> BigInt(i)) & BigInt(MASK));\n buckets[wbits] = buckets[wbits].add(points[j]);\n }\n let resI = c.ZERO; // not using this will do small speed-up, but will lose ct\n // Skip first bucket, because it is zero\n for (let j = buckets.length - 1, sumI = c.ZERO; j > 0; j--) {\n sumI = sumI.add(buckets[j]);\n resI = resI.add(sumI);\n }\n sum = sum.add(resI);\n if (i !== 0)\n for (let j = 0; j < windowSize; j++)\n sum = sum.double();\n }\n return sum;\n}\nexport function validateBasic(curve) {\n validateField(curve.Fp);\n validateObject(curve, {\n n: 'bigint',\n h: 'bigint',\n Gx: 'field',\n Gy: 'field',\n }, {\n nBitLength: 'isSafeInteger',\n nByteLength: 'isSafeInteger',\n });\n // Set defaults\n return Object.freeze({\n ...nLength(curve.n, curve.nBitLength),\n ...curve,\n ...{ p: curve.Fp.ORDER },\n });\n}\n//# sourceMappingURL=curve.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// Short Weierstrass curve. The formula is: y² = x³ + ax + b\nimport { validateBasic, wNAF, pippenger, } from './curve.js';\nimport * as mod from './modular.js';\nimport * as ut from './utils.js';\nimport { ensureBytes, memoized, abool } from './utils.js';\nfunction validateSigVerOpts(opts) {\n if (opts.lowS !== undefined)\n abool('lowS', opts.lowS);\n if (opts.prehash !== undefined)\n abool('prehash', opts.prehash);\n}\nfunction validatePointOpts(curve) {\n const opts = validateBasic(curve);\n ut.validateObject(opts, {\n a: 'field',\n b: 'field',\n }, {\n allowedPrivateKeyLengths: 'array',\n wrapPrivateKey: 'boolean',\n isTorsionFree: 'function',\n clearCofactor: 'function',\n allowInfinityPoint: 'boolean',\n fromBytes: 'function',\n toBytes: 'function',\n });\n const { endo, Fp, a } = opts;\n if (endo) {\n if (!Fp.eql(a, Fp.ZERO)) {\n throw new Error('Endomorphism can only be defined for Koblitz curves that have a=0');\n }\n if (typeof endo !== 'object' ||\n typeof endo.beta !== 'bigint' ||\n typeof endo.splitScalar !== 'function') {\n throw new Error('Expected endomorphism with beta: bigint and splitScalar: function');\n }\n }\n return Object.freeze({ ...opts });\n}\nconst { bytesToNumberBE: b2n, hexToBytes: h2b } = ut;\n/**\n * ASN.1 DER encoding utilities. ASN is very complex & fragile. Format:\n *\n * [0x30 (SEQUENCE), bytelength, 0x02 (INTEGER), intLength, R, 0x02 (INTEGER), intLength, S]\n *\n * Docs: https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der/, https://luca.ntop.org/Teaching/Appunti/asn1.html\n */\nexport const DER = {\n // asn.1 DER encoding utils\n Err: class DERErr extends Error {\n constructor(m = '') {\n super(m);\n }\n },\n // Basic building block is TLV (Tag-Length-Value)\n _tlv: {\n encode: (tag, data) => {\n const { Err: E } = DER;\n if (tag < 0 || tag > 256)\n throw new E('tlv.encode: wrong tag');\n if (data.length & 1)\n throw new E('tlv.encode: unpadded data');\n const dataLen = data.length / 2;\n const len = ut.numberToHexUnpadded(dataLen);\n if ((len.length / 2) & 128)\n throw new E('tlv.encode: long form length too big');\n // length of length with long form flag\n const lenLen = dataLen > 127 ? ut.numberToHexUnpadded((len.length / 2) | 128) : '';\n return `${ut.numberToHexUnpadded(tag)}${lenLen}${len}${data}`;\n },\n // v - value, l - left bytes (unparsed)\n decode(tag, data) {\n const { Err: E } = DER;\n let pos = 0;\n if (tag < 0 || tag > 256)\n throw new E('tlv.encode: wrong tag');\n if (data.length < 2 || data[pos++] !== tag)\n throw new E('tlv.decode: wrong tlv');\n const first = data[pos++];\n const isLong = !!(first & 128); // First bit of first length byte is flag for short/long form\n let length = 0;\n if (!isLong)\n length = first;\n else {\n // Long form: [longFlag(1bit), lengthLength(7bit), length (BE)]\n const lenLen = first & 127;\n if (!lenLen)\n throw new E('tlv.decode(long): indefinite length not supported');\n if (lenLen > 4)\n throw new E('tlv.decode(long): byte length is too big'); // this will overflow u32 in js\n const lengthBytes = data.subarray(pos, pos + lenLen);\n if (lengthBytes.length !== lenLen)\n throw new E('tlv.decode: length bytes not complete');\n if (lengthBytes[0] === 0)\n throw new E('tlv.decode(long): zero leftmost byte');\n for (const b of lengthBytes)\n length = (length << 8) | b;\n pos += lenLen;\n if (length < 128)\n throw new E('tlv.decode(long): not minimal encoding');\n }\n const v = data.subarray(pos, pos + length);\n if (v.length !== length)\n throw new E('tlv.decode: wrong value length');\n return { v, l: data.subarray(pos + length) };\n },\n },\n // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,\n // since we always use positive integers here. It must always be empty:\n // - add zero byte if exists\n // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)\n _int: {\n encode(num) {\n const { Err: E } = DER;\n if (num < _0n)\n throw new E('integer: negative integers are not allowed');\n let hex = ut.numberToHexUnpadded(num);\n // Pad with zero byte if negative flag is present\n if (Number.parseInt(hex[0], 16) & 0b1000)\n hex = '00' + hex;\n if (hex.length & 1)\n throw new E('unexpected assertion');\n return hex;\n },\n decode(data) {\n const { Err: E } = DER;\n if (data[0] & 128)\n throw new E('Invalid signature integer: negative');\n if (data[0] === 0x00 && !(data[1] & 128))\n throw new E('Invalid signature integer: unnecessary leading zero');\n return b2n(data);\n },\n },\n toSig(hex) {\n // parse DER signature\n const { Err: E, _int: int, _tlv: tlv } = DER;\n const data = typeof hex === 'string' ? h2b(hex) : hex;\n ut.abytes(data);\n const { v: seqBytes, l: seqLeftBytes } = tlv.decode(0x30, data);\n if (seqLeftBytes.length)\n throw new E('Invalid signature: left bytes after parsing');\n const { v: rBytes, l: rLeftBytes } = tlv.decode(0x02, seqBytes);\n const { v: sBytes, l: sLeftBytes } = tlv.decode(0x02, rLeftBytes);\n if (sLeftBytes.length)\n throw new E('Invalid signature: left bytes after parsing');\n return { r: int.decode(rBytes), s: int.decode(sBytes) };\n },\n hexFromSig(sig) {\n const { _tlv: tlv, _int: int } = DER;\n const seq = `${tlv.encode(0x02, int.encode(sig.r))}${tlv.encode(0x02, int.encode(sig.s))}`;\n return tlv.encode(0x30, seq);\n },\n};\n// Be friendly to bad ECMAScript parsers by not using bigint literals\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4);\nexport function weierstrassPoints(opts) {\n const CURVE = validatePointOpts(opts);\n const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ\n const Fn = mod.Field(CURVE.n, CURVE.nBitLength);\n const toBytes = CURVE.toBytes ||\n ((_c, point, _isCompressed) => {\n const a = point.toAffine();\n return ut.concatBytes(Uint8Array.from([0x04]), Fp.toBytes(a.x), Fp.toBytes(a.y));\n });\n const fromBytes = CURVE.fromBytes ||\n ((bytes) => {\n // const head = bytes[0];\n const tail = bytes.subarray(1);\n // if (head !== 0x04) throw new Error('Only non-compressed encoding is supported');\n const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES));\n const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES));\n return { x, y };\n });\n /**\n * y² = x³ + ax + b: Short weierstrass curve formula\n * @returns y²\n */\n function weierstrassEquation(x) {\n const { a, b } = CURVE;\n const x2 = Fp.sqr(x); // x * x\n const x3 = Fp.mul(x2, x); // x2 * x\n return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x3 + a * x + b\n }\n // Validate whether the passed curve params are valid.\n // We check if curve equation works for generator point.\n // `assertValidity()` won't work: `isTorsionFree()` is not available at this point in bls12-381.\n // ProjectivePoint class has not been initialized yet.\n if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))\n throw new Error('bad generator point: equation left != right');\n // Valid group elements reside in range 1..n-1\n function isWithinCurveOrder(num) {\n return ut.inRange(num, _1n, CURVE.n);\n }\n // Validates if priv key is valid and converts it to bigint.\n // Supports options allowedPrivateKeyLengths and wrapPrivateKey.\n function normPrivateKeyToScalar(key) {\n const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n: N } = CURVE;\n if (lengths && typeof key !== 'bigint') {\n if (ut.isBytes(key))\n key = ut.bytesToHex(key);\n // Normalize to hex string, pad. E.g. P521 would norm 130-132 char hex to 132-char bytes\n if (typeof key !== 'string' || !lengths.includes(key.length))\n throw new Error('Invalid key');\n key = key.padStart(nByteLength * 2, '0');\n }\n let num;\n try {\n num =\n typeof key === 'bigint'\n ? key\n : ut.bytesToNumberBE(ensureBytes('private key', key, nByteLength));\n }\n catch (error) {\n throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`);\n }\n if (wrapPrivateKey)\n num = mod.mod(num, N); // disabled by default, enabled for BLS\n ut.aInRange('private key', num, _1n, N); // num in range [1..N-1]\n return num;\n }\n function assertPrjPoint(other) {\n if (!(other instanceof Point))\n throw new Error('ProjectivePoint expected');\n }\n // Memoized toAffine / validity check. They are heavy. Points are immutable.\n // Converts Projective point to affine (x, y) coordinates.\n // Can accept precomputed Z^-1 - for example, from invertBatch.\n // (x, y, z) ∋ (x=x/z, y=y/z)\n const toAffineMemo = memoized((p, iz) => {\n const { px: x, py: y, pz: z } = p;\n // Fast-path for normalized points\n if (Fp.eql(z, Fp.ONE))\n return { x, y };\n const is0 = p.is0();\n // If invZ was 0, we return zero point. However we still want to execute\n // all operations, so we replace invZ with a random number, 1.\n if (iz == null)\n iz = is0 ? Fp.ONE : Fp.inv(z);\n const ax = Fp.mul(x, iz);\n const ay = Fp.mul(y, iz);\n const zz = Fp.mul(z, iz);\n if (is0)\n return { x: Fp.ZERO, y: Fp.ZERO };\n if (!Fp.eql(zz, Fp.ONE))\n throw new Error('invZ was invalid');\n return { x: ax, y: ay };\n });\n // NOTE: on exception this will crash 'cached' and no value will be set.\n // Otherwise true will be return\n const assertValidMemo = memoized((p) => {\n if (p.is0()) {\n // (0, 1, 0) aka ZERO is invalid in most contexts.\n // In BLS, ZERO can be serialized, so we allow it.\n // (0, 0, 0) is wrong representation of ZERO and is always invalid.\n if (CURVE.allowInfinityPoint && !Fp.is0(p.py))\n return;\n throw new Error('bad point: ZERO');\n }\n // Some 3rd-party test vectors require different wording between here & `fromCompressedHex`\n const { x, y } = p.toAffine();\n // Check if x, y are valid field elements\n if (!Fp.isValid(x) || !Fp.isValid(y))\n throw new Error('bad point: x or y not FE');\n const left = Fp.sqr(y); // y²\n const right = weierstrassEquation(x); // x³ + ax + b\n if (!Fp.eql(left, right))\n throw new Error('bad point: equation left != right');\n if (!p.isTorsionFree())\n throw new Error('bad point: not in prime-order subgroup');\n return true;\n });\n /**\n * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z)\n * Default Point works in 2d / affine coordinates: (x, y)\n * We're doing calculations in projective, because its operations don't require costly inversion.\n */\n class Point {\n constructor(px, py, pz) {\n this.px = px;\n this.py = py;\n this.pz = pz;\n if (px == null || !Fp.isValid(px))\n throw new Error('x required');\n if (py == null || !Fp.isValid(py))\n throw new Error('y required');\n if (pz == null || !Fp.isValid(pz))\n throw new Error('z required');\n Object.freeze(this);\n }\n // Does not validate if the point is on-curve.\n // Use fromHex instead, or call assertValidity() later.\n static fromAffine(p) {\n const { x, y } = p || {};\n if (!p || !Fp.isValid(x) || !Fp.isValid(y))\n throw new Error('invalid affine point');\n if (p instanceof Point)\n throw new Error('projective point not allowed');\n const is0 = (i) => Fp.eql(i, Fp.ZERO);\n // fromAffine(x:0, y:0) would produce (x:0, y:0, z:1), but we need (x:0, y:1, z:0)\n if (is0(x) && is0(y))\n return Point.ZERO;\n return new Point(x, y, Fp.ONE);\n }\n get x() {\n return this.toAffine().x;\n }\n get y() {\n return this.toAffine().y;\n }\n /**\n * Takes a bunch of Projective Points but executes only one\n * inversion on all of them. Inversion is very slow operation,\n * so this improves performance massively.\n * Optimization: converts a list of projective points to a list of identical points with Z=1.\n */\n static normalizeZ(points) {\n const toInv = Fp.invertBatch(points.map((p) => p.pz));\n return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);\n }\n /**\n * Converts hash string or Uint8Array to Point.\n * @param hex short/long ECDSA hex\n */\n static fromHex(hex) {\n const P = Point.fromAffine(fromBytes(ensureBytes('pointHex', hex)));\n P.assertValidity();\n return P;\n }\n // Multiplies generator point by privateKey.\n static fromPrivateKey(privateKey) {\n return Point.BASE.multiply(normPrivateKeyToScalar(privateKey));\n }\n // Multiscalar Multiplication\n static msm(points, scalars) {\n return pippenger(Point, Fn, points, scalars);\n }\n // \"Private method\", don't use it directly\n _setWindowSize(windowSize) {\n wnaf.setWindowSize(this, windowSize);\n }\n // A point on curve is valid if it conforms to equation.\n assertValidity() {\n assertValidMemo(this);\n }\n hasEvenY() {\n const { y } = this.toAffine();\n if (Fp.isOdd)\n return !Fp.isOdd(y);\n throw new Error(\"Field doesn't support isOdd\");\n }\n /**\n * Compare one point to another.\n */\n equals(other) {\n assertPrjPoint(other);\n const { px: X1, py: Y1, pz: Z1 } = this;\n const { px: X2, py: Y2, pz: Z2 } = other;\n const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1));\n const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1));\n return U1 && U2;\n }\n /**\n * Flips point to one corresponding to (x, -y) in Affine coordinates.\n */\n negate() {\n return new Point(this.px, Fp.neg(this.py), this.pz);\n }\n // Renes-Costello-Batina exception-free doubling formula.\n // There is 30% faster Jacobian formula, but it is not complete.\n // https://eprint.iacr.org/2015/1060, algorithm 3\n // Cost: 8M + 3S + 3*a + 2*b3 + 15add.\n double() {\n const { a, b } = CURVE;\n const b3 = Fp.mul(b, _3n);\n const { px: X1, py: Y1, pz: Z1 } = this;\n let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n let t0 = Fp.mul(X1, X1); // step 1\n let t1 = Fp.mul(Y1, Y1);\n let t2 = Fp.mul(Z1, Z1);\n let t3 = Fp.mul(X1, Y1);\n t3 = Fp.add(t3, t3); // step 5\n Z3 = Fp.mul(X1, Z1);\n Z3 = Fp.add(Z3, Z3);\n X3 = Fp.mul(a, Z3);\n Y3 = Fp.mul(b3, t2);\n Y3 = Fp.add(X3, Y3); // step 10\n X3 = Fp.sub(t1, Y3);\n Y3 = Fp.add(t1, Y3);\n Y3 = Fp.mul(X3, Y3);\n X3 = Fp.mul(t3, X3);\n Z3 = Fp.mul(b3, Z3); // step 15\n t2 = Fp.mul(a, t2);\n t3 = Fp.sub(t0, t2);\n t3 = Fp.mul(a, t3);\n t3 = Fp.add(t3, Z3);\n Z3 = Fp.add(t0, t0); // step 20\n t0 = Fp.add(Z3, t0);\n t0 = Fp.add(t0, t2);\n t0 = Fp.mul(t0, t3);\n Y3 = Fp.add(Y3, t0);\n t2 = Fp.mul(Y1, Z1); // step 25\n t2 = Fp.add(t2, t2);\n t0 = Fp.mul(t2, t3);\n X3 = Fp.sub(X3, t0);\n Z3 = Fp.mul(t2, t1);\n Z3 = Fp.add(Z3, Z3); // step 30\n Z3 = Fp.add(Z3, Z3);\n return new Point(X3, Y3, Z3);\n }\n // Renes-Costello-Batina exception-free addition formula.\n // There is 30% faster Jacobian formula, but it is not complete.\n // https://eprint.iacr.org/2015/1060, algorithm 1\n // Cost: 12M + 0S + 3*a + 3*b3 + 23add.\n add(other) {\n assertPrjPoint(other);\n const { px: X1, py: Y1, pz: Z1 } = this;\n const { px: X2, py: Y2, pz: Z2 } = other;\n let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n const a = CURVE.a;\n const b3 = Fp.mul(CURVE.b, _3n);\n let t0 = Fp.mul(X1, X2); // step 1\n let t1 = Fp.mul(Y1, Y2);\n let t2 = Fp.mul(Z1, Z2);\n let t3 = Fp.add(X1, Y1);\n let t4 = Fp.add(X2, Y2); // step 5\n t3 = Fp.mul(t3, t4);\n t4 = Fp.add(t0, t1);\n t3 = Fp.sub(t3, t4);\n t4 = Fp.add(X1, Z1);\n let t5 = Fp.add(X2, Z2); // step 10\n t4 = Fp.mul(t4, t5);\n t5 = Fp.add(t0, t2);\n t4 = Fp.sub(t4, t5);\n t5 = Fp.add(Y1, Z1);\n X3 = Fp.add(Y2, Z2); // step 15\n t5 = Fp.mul(t5, X3);\n X3 = Fp.add(t1, t2);\n t5 = Fp.sub(t5, X3);\n Z3 = Fp.mul(a, t4);\n X3 = Fp.mul(b3, t2); // step 20\n Z3 = Fp.add(X3, Z3);\n X3 = Fp.sub(t1, Z3);\n Z3 = Fp.add(t1, Z3);\n Y3 = Fp.mul(X3, Z3);\n t1 = Fp.add(t0, t0); // step 25\n t1 = Fp.add(t1, t0);\n t2 = Fp.mul(a, t2);\n t4 = Fp.mul(b3, t4);\n t1 = Fp.add(t1, t2);\n t2 = Fp.sub(t0, t2); // step 30\n t2 = Fp.mul(a, t2);\n t4 = Fp.add(t4, t2);\n t0 = Fp.mul(t1, t4);\n Y3 = Fp.add(Y3, t0);\n t0 = Fp.mul(t5, t4); // step 35\n X3 = Fp.mul(t3, X3);\n X3 = Fp.sub(X3, t0);\n t0 = Fp.mul(t3, t1);\n Z3 = Fp.mul(t5, Z3);\n Z3 = Fp.add(Z3, t0); // step 40\n return new Point(X3, Y3, Z3);\n }\n subtract(other) {\n return this.add(other.negate());\n }\n is0() {\n return this.equals(Point.ZERO);\n }\n wNAF(n) {\n return wnaf.wNAFCached(this, n, Point.normalizeZ);\n }\n /**\n * Non-constant-time multiplication. Uses double-and-add algorithm.\n * It's faster, but should only be used when you don't care about\n * an exposed private key e.g. sig verification, which works over *public* keys.\n */\n multiplyUnsafe(sc) {\n ut.aInRange('scalar', sc, _0n, CURVE.n);\n const I = Point.ZERO;\n if (sc === _0n)\n return I;\n if (sc === _1n)\n return this;\n const { endo } = CURVE;\n if (!endo)\n return wnaf.unsafeLadder(this, sc);\n // Apply endomorphism\n let { k1neg, k1, k2neg, k2 } = endo.splitScalar(sc);\n let k1p = I;\n let k2p = I;\n let d = this;\n while (k1 > _0n || k2 > _0n) {\n if (k1 & _1n)\n k1p = k1p.add(d);\n if (k2 & _1n)\n k2p = k2p.add(d);\n d = d.double();\n k1 >>= _1n;\n k2 >>= _1n;\n }\n if (k1neg)\n k1p = k1p.negate();\n if (k2neg)\n k2p = k2p.negate();\n k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz);\n return k1p.add(k2p);\n }\n /**\n * Constant time multiplication.\n * Uses wNAF method. Windowed method may be 10% faster,\n * but takes 2x longer to generate and consumes 2x memory.\n * Uses precomputes when available.\n * Uses endomorphism for Koblitz curves.\n * @param scalar by which the point would be multiplied\n * @returns New point\n */\n multiply(scalar) {\n const { endo, n: N } = CURVE;\n ut.aInRange('scalar', scalar, _1n, N);\n let point, fake; // Fake point is used to const-time mult\n if (endo) {\n const { k1neg, k1, k2neg, k2 } = endo.splitScalar(scalar);\n let { p: k1p, f: f1p } = this.wNAF(k1);\n let { p: k2p, f: f2p } = this.wNAF(k2);\n k1p = wnaf.constTimeNegate(k1neg, k1p);\n k2p = wnaf.constTimeNegate(k2neg, k2p);\n k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz);\n point = k1p.add(k2p);\n fake = f1p.add(f2p);\n }\n else {\n const { p, f } = this.wNAF(scalar);\n point = p;\n fake = f;\n }\n // Normalize `z` for both points, but return only real one\n return Point.normalizeZ([point, fake])[0];\n }\n /**\n * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.\n * Not using Strauss-Shamir trick: precomputation tables are faster.\n * The trick could be useful if both P and Q are not G (not in our case).\n * @returns non-zero affine point\n */\n multiplyAndAddUnsafe(Q, a, b) {\n const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes\n const mul = (P, a // Select faster multiply() method\n ) => (a === _0n || a === _1n || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a));\n const sum = mul(this, a).add(mul(Q, b));\n return sum.is0() ? undefined : sum;\n }\n // Converts Projective point to affine (x, y) coordinates.\n // Can accept precomputed Z^-1 - for example, from invertBatch.\n // (x, y, z) ∋ (x=x/z, y=y/z)\n toAffine(iz) {\n return toAffineMemo(this, iz);\n }\n isTorsionFree() {\n const { h: cofactor, isTorsionFree } = CURVE;\n if (cofactor === _1n)\n return true; // No subgroups, always torsion-free\n if (isTorsionFree)\n return isTorsionFree(Point, this);\n throw new Error('isTorsionFree() has not been declared for the elliptic curve');\n }\n clearCofactor() {\n const { h: cofactor, clearCofactor } = CURVE;\n if (cofactor === _1n)\n return this; // Fast-path\n if (clearCofactor)\n return clearCofactor(Point, this);\n return this.multiplyUnsafe(CURVE.h);\n }\n toRawBytes(isCompressed = true) {\n abool('isCompressed', isCompressed);\n this.assertValidity();\n return toBytes(Point, this, isCompressed);\n }\n toHex(isCompressed = true) {\n abool('isCompressed', isCompressed);\n return ut.bytesToHex(this.toRawBytes(isCompressed));\n }\n }\n Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);\n Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO);\n const _bits = CURVE.nBitLength;\n const wnaf = wNAF(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits);\n // Validate if generator point is on curve\n return {\n CURVE,\n ProjectivePoint: Point,\n normPrivateKeyToScalar,\n weierstrassEquation,\n isWithinCurveOrder,\n };\n}\nfunction validateOpts(curve) {\n const opts = validateBasic(curve);\n ut.validateObject(opts, {\n hash: 'hash',\n hmac: 'function',\n randomBytes: 'function',\n }, {\n bits2int: 'function',\n bits2int_modN: 'function',\n lowS: 'boolean',\n });\n return Object.freeze({ lowS: true, ...opts });\n}\n/**\n * Creates short weierstrass curve and ECDSA signature methods for it.\n * @example\n * import { Field } from '@noble/curves/abstract/modular';\n * // Before that, define BigInt-s: a, b, p, n, Gx, Gy\n * const curve = weierstrass({ a, b, Fp: Field(p), n, Gx, Gy, h: 1n })\n */\nexport function weierstrass(curveDef) {\n const CURVE = validateOpts(curveDef);\n const { Fp, n: CURVE_ORDER } = CURVE;\n const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32\n const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32\n function modN(a) {\n return mod.mod(a, CURVE_ORDER);\n }\n function invN(a) {\n return mod.invert(a, CURVE_ORDER);\n }\n const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder, } = weierstrassPoints({\n ...CURVE,\n toBytes(_c, point, isCompressed) {\n const a = point.toAffine();\n const x = Fp.toBytes(a.x);\n const cat = ut.concatBytes;\n abool('isCompressed', isCompressed);\n if (isCompressed) {\n return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x);\n }\n else {\n return cat(Uint8Array.from([0x04]), x, Fp.toBytes(a.y));\n }\n },\n fromBytes(bytes) {\n const len = bytes.length;\n const head = bytes[0];\n const tail = bytes.subarray(1);\n // this.assertValidity() is done inside of fromHex\n if (len === compressedLen && (head === 0x02 || head === 0x03)) {\n const x = ut.bytesToNumberBE(tail);\n if (!ut.inRange(x, _1n, Fp.ORDER))\n throw new Error('Point is not on curve');\n const y2 = weierstrassEquation(x); // y² = x³ + ax + b\n let y;\n try {\n y = Fp.sqrt(y2); // y = y² ^ (p+1)/4\n }\n catch (sqrtError) {\n const suffix = sqrtError instanceof Error ? ': ' + sqrtError.message : '';\n throw new Error('Point is not on curve' + suffix);\n }\n const isYOdd = (y & _1n) === _1n;\n // ECDSA\n const isHeadOdd = (head & 1) === 1;\n if (isHeadOdd !== isYOdd)\n y = Fp.neg(y);\n return { x, y };\n }\n else if (len === uncompressedLen && head === 0x04) {\n const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES));\n const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES));\n return { x, y };\n }\n else {\n throw new Error(`Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes`);\n }\n },\n });\n const numToNByteStr = (num) => ut.bytesToHex(ut.numberToBytesBE(num, CURVE.nByteLength));\n function isBiggerThanHalfOrder(number) {\n const HALF = CURVE_ORDER >> _1n;\n return number > HALF;\n }\n function normalizeS(s) {\n return isBiggerThanHalfOrder(s) ? modN(-s) : s;\n }\n // slice bytes num\n const slcNum = (b, from, to) => ut.bytesToNumberBE(b.slice(from, to));\n /**\n * ECDSA signature with its (r, s) properties. Supports DER & compact representations.\n */\n class Signature {\n constructor(r, s, recovery) {\n this.r = r;\n this.s = s;\n this.recovery = recovery;\n this.assertValidity();\n }\n // pair (bytes of r, bytes of s)\n static fromCompact(hex) {\n const l = CURVE.nByteLength;\n hex = ensureBytes('compactSignature', hex, l * 2);\n return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));\n }\n // DER encoded ECDSA signature\n // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script\n static fromDER(hex) {\n const { r, s } = DER.toSig(ensureBytes('DER', hex));\n return new Signature(r, s);\n }\n assertValidity() {\n ut.aInRange('r', this.r, _1n, CURVE_ORDER); // r in [1..N]\n ut.aInRange('s', this.s, _1n, CURVE_ORDER); // s in [1..N]\n }\n addRecoveryBit(recovery) {\n return new Signature(this.r, this.s, recovery);\n }\n recoverPublicKey(msgHash) {\n const { r, s, recovery: rec } = this;\n const h = bits2int_modN(ensureBytes('msgHash', msgHash)); // Truncate hash\n if (rec == null || ![0, 1, 2, 3].includes(rec))\n throw new Error('recovery id invalid');\n const radj = rec === 2 || rec === 3 ? r + CURVE.n : r;\n if (radj >= Fp.ORDER)\n throw new Error('recovery id 2 or 3 invalid');\n const prefix = (rec & 1) === 0 ? '02' : '03';\n const R = Point.fromHex(prefix + numToNByteStr(radj));\n const ir = invN(radj); // r^-1\n const u1 = modN(-h * ir); // -hr^-1\n const u2 = modN(s * ir); // sr^-1\n const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1)\n if (!Q)\n throw new Error('point at infinify'); // unsafe is fine: no priv data leaked\n Q.assertValidity();\n return Q;\n }\n // Signatures should be low-s, to prevent malleability.\n hasHighS() {\n return isBiggerThanHalfOrder(this.s);\n }\n normalizeS() {\n return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this;\n }\n // DER-encoded\n toDERRawBytes() {\n return ut.hexToBytes(this.toDERHex());\n }\n toDERHex() {\n return DER.hexFromSig({ r: this.r, s: this.s });\n }\n // padded bytes of r, then padded bytes of s\n toCompactRawBytes() {\n return ut.hexToBytes(this.toCompactHex());\n }\n toCompactHex() {\n return numToNByteStr(this.r) + numToNByteStr(this.s);\n }\n }\n const utils = {\n isValidPrivateKey(privateKey) {\n try {\n normPrivateKeyToScalar(privateKey);\n return true;\n }\n catch (error) {\n return false;\n }\n },\n normPrivateKeyToScalar: normPrivateKeyToScalar,\n /**\n * Produces cryptographically secure private key from random of size\n * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.\n */\n randomPrivateKey: () => {\n const length = mod.getMinHashLength(CURVE.n);\n return mod.mapHashToField(CURVE.randomBytes(length), CURVE.n);\n },\n /**\n * Creates precompute table for an arbitrary EC point. Makes point \"cached\".\n * Allows to massively speed-up `point.multiply(scalar)`.\n * @returns cached point\n * @example\n * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));\n * fast.multiply(privKey); // much faster ECDH now\n */\n precompute(windowSize = 8, point = Point.BASE) {\n point._setWindowSize(windowSize);\n point.multiply(BigInt(3)); // 3 is arbitrary, just need any number here\n return point;\n },\n };\n /**\n * Computes public key for a private key. Checks for validity of the private key.\n * @param privateKey private key\n * @param isCompressed whether to return compact (default), or full key\n * @returns Public key, full when isCompressed=false; short when isCompressed=true\n */\n function getPublicKey(privateKey, isCompressed = true) {\n return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed);\n }\n /**\n * Quick and dirty check for item being public key. Does not validate hex, or being on-curve.\n */\n function isProbPub(item) {\n const arr = ut.isBytes(item);\n const str = typeof item === 'string';\n const len = (arr || str) && item.length;\n if (arr)\n return len === compressedLen || len === uncompressedLen;\n if (str)\n return len === 2 * compressedLen || len === 2 * uncompressedLen;\n if (item instanceof Point)\n return true;\n return false;\n }\n /**\n * ECDH (Elliptic Curve Diffie Hellman).\n * Computes shared public key from private key and public key.\n * Checks: 1) private key validity 2) shared key is on-curve.\n * Does NOT hash the result.\n * @param privateA private key\n * @param publicB different public key\n * @param isCompressed whether to return compact (default), or full key\n * @returns shared public key\n */\n function getSharedSecret(privateA, publicB, isCompressed = true) {\n if (isProbPub(privateA))\n throw new Error('first arg must be private key');\n if (!isProbPub(publicB))\n throw new Error('second arg must be public key');\n const b = Point.fromHex(publicB); // check for being on-curve\n return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);\n }\n // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets.\n // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int.\n // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same.\n // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors\n const bits2int = CURVE.bits2int ||\n function (bytes) {\n // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m)\n // for some cases, since bytes.length * 8 is not actual bitLength.\n const num = ut.bytesToNumberBE(bytes); // check for == u8 done here\n const delta = bytes.length * 8 - CURVE.nBitLength; // truncate to nBitLength leftmost bits\n return delta > 0 ? num >> BigInt(delta) : num;\n };\n const bits2int_modN = CURVE.bits2int_modN ||\n function (bytes) {\n return modN(bits2int(bytes)); // can't use bytesToNumberBE here\n };\n // NOTE: pads output with zero as per spec\n const ORDER_MASK = ut.bitMask(CURVE.nBitLength);\n /**\n * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`.\n */\n function int2octets(num) {\n ut.aInRange(`num < 2^${CURVE.nBitLength}`, num, _0n, ORDER_MASK);\n // works with order, can have different size than numToField!\n return ut.numberToBytesBE(num, CURVE.nByteLength);\n }\n // Steps A, D of RFC6979 3.2\n // Creates RFC6979 seed; converts msg/privKey to numbers.\n // Used only in sign, not in verify.\n // NOTE: we cannot assume here that msgHash has same amount of bytes as curve order, this will be wrong at least for P521.\n // Also it can be bigger for P224 + SHA256\n function prepSig(msgHash, privateKey, opts = defaultSigOpts) {\n if (['recovered', 'canonical'].some((k) => k in opts))\n throw new Error('sign() legacy options not supported');\n const { hash, randomBytes } = CURVE;\n let { lowS, prehash, extraEntropy: ent } = opts; // generates low-s sigs by default\n if (lowS == null)\n lowS = true; // RFC6979 3.2: we skip step A, because we already provide hash\n msgHash = ensureBytes('msgHash', msgHash);\n validateSigVerOpts(opts);\n if (prehash)\n msgHash = ensureBytes('prehashed msgHash', hash(msgHash));\n // We can't later call bits2octets, since nested bits2int is broken for curves\n // with nBitLength % 8 !== 0. Because of that, we unwrap it here as int2octets call.\n // const bits2octets = (bits) => int2octets(bits2int_modN(bits))\n const h1int = bits2int_modN(msgHash);\n const d = normPrivateKeyToScalar(privateKey); // validate private key, convert to bigint\n const seedArgs = [int2octets(d), int2octets(h1int)];\n // extraEntropy. RFC6979 3.6: additional k' (optional).\n if (ent != null && ent !== false) {\n // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k')\n const e = ent === true ? randomBytes(Fp.BYTES) : ent; // generate random bytes OR pass as-is\n seedArgs.push(ensureBytes('extraEntropy', e)); // check for being bytes\n }\n const seed = ut.concatBytes(...seedArgs); // Step D of RFC6979 3.2\n const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash!\n // Converts signature params into point w r/s, checks result for validity.\n function k2sig(kBytes) {\n // RFC 6979 Section 3.2, step 3: k = bits2int(T)\n const k = bits2int(kBytes); // Cannot use fields methods, since it is group element\n if (!isWithinCurveOrder(k))\n return; // Important: all mod() calls here must be done over N\n const ik = invN(k); // k^-1 mod n\n const q = Point.BASE.multiply(k).toAffine(); // q = Gk\n const r = modN(q.x); // r = q.x mod n\n if (r === _0n)\n return;\n // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to\n // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it:\n // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT\n const s = modN(ik * modN(m + r * d)); // Not using blinding here\n if (s === _0n)\n return;\n let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3, when q.x > n)\n let normS = s;\n if (lowS && isBiggerThanHalfOrder(s)) {\n normS = normalizeS(s); // if lowS was passed, ensure s is always\n recovery ^= 1; // // in the bottom half of N\n }\n return new Signature(r, normS, recovery); // use normS, not s\n }\n return { seed, k2sig };\n }\n const defaultSigOpts = { lowS: CURVE.lowS, prehash: false };\n const defaultVerOpts = { lowS: CURVE.lowS, prehash: false };\n /**\n * Signs message hash with a private key.\n * ```\n * sign(m, d, k) where\n * (x, y) = G × k\n * r = x mod n\n * s = (m + dr)/k mod n\n * ```\n * @param msgHash NOT message. msg needs to be hashed to `msgHash`, or use `prehash`.\n * @param privKey private key\n * @param opts lowS for non-malleable sigs. extraEntropy for mixing randomness into k. prehash will hash first arg.\n * @returns signature with recovery param\n */\n function sign(msgHash, privKey, opts = defaultSigOpts) {\n const { seed, k2sig } = prepSig(msgHash, privKey, opts); // Steps A, D of RFC6979 3.2.\n const C = CURVE;\n const drbg = ut.createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac);\n return drbg(seed, k2sig); // Steps B, C, D, E, F, G\n }\n // Enable precomputes. Slows down first publicKey computation by 20ms.\n Point.BASE._setWindowSize(8);\n // utils.precompute(8, ProjectivePoint.BASE)\n /**\n * Verifies a signature against message hash and public key.\n * Rejects lowS signatures by default: to override,\n * specify option `{lowS: false}`. Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf:\n *\n * ```\n * verify(r, s, h, P) where\n * U1 = hs^-1 mod n\n * U2 = rs^-1 mod n\n * R = U1⋅G - U2⋅P\n * mod(R.x, n) == r\n * ```\n */\n function verify(signature, msgHash, publicKey, opts = defaultVerOpts) {\n const sg = signature;\n msgHash = ensureBytes('msgHash', msgHash);\n publicKey = ensureBytes('publicKey', publicKey);\n if ('strict' in opts)\n throw new Error('options.strict was renamed to lowS');\n validateSigVerOpts(opts);\n const { lowS, prehash } = opts;\n let _sig = undefined;\n let P;\n try {\n if (typeof sg === 'string' || ut.isBytes(sg)) {\n // Signature can be represented in 2 ways: compact (2*nByteLength) & DER (variable-length).\n // Since DER can also be 2*nByteLength bytes, we check for it first.\n try {\n _sig = Signature.fromDER(sg);\n }\n catch (derError) {\n if (!(derError instanceof DER.Err))\n throw derError;\n _sig = Signature.fromCompact(sg);\n }\n }\n else if (typeof sg === 'object' && typeof sg.r === 'bigint' && typeof sg.s === 'bigint') {\n const { r, s } = sg;\n _sig = new Signature(r, s);\n }\n else {\n throw new Error('PARSE');\n }\n P = Point.fromHex(publicKey);\n }\n catch (error) {\n if (error.message === 'PARSE')\n throw new Error(`signature must be Signature instance, Uint8Array or hex string`);\n return false;\n }\n if (lowS && _sig.hasHighS())\n return false;\n if (prehash)\n msgHash = CURVE.hash(msgHash);\n const { r, s } = _sig;\n const h = bits2int_modN(msgHash); // Cannot use fields methods, since it is group element\n const is = invN(s); // s^-1\n const u1 = modN(h * is); // u1 = hs^-1 mod n\n const u2 = modN(r * is); // u2 = rs^-1 mod n\n const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2)?.toAffine(); // R = u1⋅G + u2⋅P\n if (!R)\n return false;\n const v = modN(R.x);\n return v === r;\n }\n return {\n CURVE,\n getPublicKey,\n getSharedSecret,\n sign,\n verify,\n ProjectivePoint: Point,\n Signature,\n utils,\n };\n}\n/**\n * Implementation of the Shallue and van de Woestijne method for any weierstrass curve.\n * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular.\n * b = True and y = sqrt(u / v) if (u / v) is square in F, and\n * b = False and y = sqrt(Z * (u / v)) otherwise.\n * @param Fp\n * @param Z\n * @returns\n */\nexport function SWUFpSqrtRatio(Fp, Z) {\n // Generic implementation\n const q = Fp.ORDER;\n let l = _0n;\n for (let o = q - _1n; o % _2n === _0n; o /= _2n)\n l += _1n;\n const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1.\n // We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<.\n // 2n ** c1 == 2n << (c1-1)\n const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n);\n const _2n_pow_c1 = _2n_pow_c1_1 * _2n;\n const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic\n const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic\n const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic\n const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1) # Integer arithmetic\n const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2\n const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2)\n let sqrtRatio = (u, v) => {\n let tv1 = c6; // 1. tv1 = c6\n let tv2 = Fp.pow(v, c4); // 2. tv2 = v^c4\n let tv3 = Fp.sqr(tv2); // 3. tv3 = tv2^2\n tv3 = Fp.mul(tv3, v); // 4. tv3 = tv3 * v\n let tv5 = Fp.mul(u, tv3); // 5. tv5 = u * tv3\n tv5 = Fp.pow(tv5, c3); // 6. tv5 = tv5^c3\n tv5 = Fp.mul(tv5, tv2); // 7. tv5 = tv5 * tv2\n tv2 = Fp.mul(tv5, v); // 8. tv2 = tv5 * v\n tv3 = Fp.mul(tv5, u); // 9. tv3 = tv5 * u\n let tv4 = Fp.mul(tv3, tv2); // 10. tv4 = tv3 * tv2\n tv5 = Fp.pow(tv4, c5); // 11. tv5 = tv4^c5\n let isQR = Fp.eql(tv5, Fp.ONE); // 12. isQR = tv5 == 1\n tv2 = Fp.mul(tv3, c7); // 13. tv2 = tv3 * c7\n tv5 = Fp.mul(tv4, tv1); // 14. tv5 = tv4 * tv1\n tv3 = Fp.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR)\n tv4 = Fp.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR)\n // 17. for i in (c1, c1 - 1, ..., 2):\n for (let i = c1; i > _1n; i--) {\n let tv5 = i - _2n; // 18. tv5 = i - 2\n tv5 = _2n << (tv5 - _1n); // 19. tv5 = 2^tv5\n let tvv5 = Fp.pow(tv4, tv5); // 20. tv5 = tv4^tv5\n const e1 = Fp.eql(tvv5, Fp.ONE); // 21. e1 = tv5 == 1\n tv2 = Fp.mul(tv3, tv1); // 22. tv2 = tv3 * tv1\n tv1 = Fp.mul(tv1, tv1); // 23. tv1 = tv1 * tv1\n tvv5 = Fp.mul(tv4, tv1); // 24. tv5 = tv4 * tv1\n tv3 = Fp.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1)\n tv4 = Fp.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1)\n }\n return { isValid: isQR, value: tv3 };\n };\n if (Fp.ORDER % _4n === _3n) {\n // sqrt_ratio_3mod4(u, v)\n const c1 = (Fp.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic\n const c2 = Fp.sqrt(Fp.neg(Z)); // 2. c2 = sqrt(-Z)\n sqrtRatio = (u, v) => {\n let tv1 = Fp.sqr(v); // 1. tv1 = v^2\n const tv2 = Fp.mul(u, v); // 2. tv2 = u * v\n tv1 = Fp.mul(tv1, tv2); // 3. tv1 = tv1 * tv2\n let y1 = Fp.pow(tv1, c1); // 4. y1 = tv1^c1\n y1 = Fp.mul(y1, tv2); // 5. y1 = y1 * tv2\n const y2 = Fp.mul(y1, c2); // 6. y2 = y1 * c2\n const tv3 = Fp.mul(Fp.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v\n const isQR = Fp.eql(tv3, u); // 9. isQR = tv3 == u\n let y = Fp.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR)\n return { isValid: isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2\n };\n }\n // No curves uses that\n // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8\n return sqrtRatio;\n}\n/**\n * Simplified Shallue-van de Woestijne-Ulas Method\n * https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2\n */\nexport function mapToCurveSimpleSWU(Fp, opts) {\n mod.validateField(Fp);\n if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z))\n throw new Error('mapToCurveSimpleSWU: invalid opts');\n const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z);\n if (!Fp.isOdd)\n throw new Error('Fp.isOdd is not implemented!');\n // Input: u, an element of F.\n // Output: (x, y), a point on E.\n return (u) => {\n // prettier-ignore\n let tv1, tv2, tv3, tv4, tv5, tv6, x, y;\n tv1 = Fp.sqr(u); // 1. tv1 = u^2\n tv1 = Fp.mul(tv1, opts.Z); // 2. tv1 = Z * tv1\n tv2 = Fp.sqr(tv1); // 3. tv2 = tv1^2\n tv2 = Fp.add(tv2, tv1); // 4. tv2 = tv2 + tv1\n tv3 = Fp.add(tv2, Fp.ONE); // 5. tv3 = tv2 + 1\n tv3 = Fp.mul(tv3, opts.B); // 6. tv3 = B * tv3\n tv4 = Fp.cmov(opts.Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0)\n tv4 = Fp.mul(tv4, opts.A); // 8. tv4 = A * tv4\n tv2 = Fp.sqr(tv3); // 9. tv2 = tv3^2\n tv6 = Fp.sqr(tv4); // 10. tv6 = tv4^2\n tv5 = Fp.mul(tv6, opts.A); // 11. tv5 = A * tv6\n tv2 = Fp.add(tv2, tv5); // 12. tv2 = tv2 + tv5\n tv2 = Fp.mul(tv2, tv3); // 13. tv2 = tv2 * tv3\n tv6 = Fp.mul(tv6, tv4); // 14. tv6 = tv6 * tv4\n tv5 = Fp.mul(tv6, opts.B); // 15. tv5 = B * tv6\n tv2 = Fp.add(tv2, tv5); // 16. tv2 = tv2 + tv5\n x = Fp.mul(tv1, tv3); // 17. x = tv1 * tv3\n const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6)\n y = Fp.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1\n y = Fp.mul(y, value); // 20. y = y * y1\n x = Fp.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square)\n y = Fp.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square)\n const e1 = Fp.isOdd(u) === Fp.isOdd(y); // 23. e1 = sgn0(u) == sgn0(y)\n y = Fp.cmov(Fp.neg(y), y, e1); // 24. y = CMOV(-y, y, e1)\n x = Fp.div(x, tv4); // 25. x = x / tv4\n return { x, y };\n };\n}\n//# sourceMappingURL=weierstrass.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { hmac } from '@noble/hashes/hmac';\nimport { concatBytes, randomBytes } from '@noble/hashes/utils';\nimport { weierstrass } from './abstract/weierstrass.js';\n// connects noble-curves to noble-hashes\nexport function getHash(hash) {\n return {\n hash,\n hmac: (key, ...msgs) => hmac(hash, key, concatBytes(...msgs)),\n randomBytes,\n };\n}\nexport function createCurve(curveDef, defHash) {\n const create = (hash) => weierstrass({ ...curveDef, ...getHash(hash) });\n return Object.freeze({ ...create(defHash), create });\n}\n//# sourceMappingURL=_shortw_utils.js.map","/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { sha256 } from '@noble/hashes/sha256';\nimport { randomBytes } from '@noble/hashes/utils';\nimport { createCurve } from './_shortw_utils.js';\nimport { createHasher, isogenyMap } from './abstract/hash-to-curve.js';\nimport { Field, mod, pow2 } from './abstract/modular.js';\nimport { inRange, aInRange, bytesToNumberBE, concatBytes, ensureBytes, numberToBytesBE, } from './abstract/utils.js';\nimport { mapToCurveSimpleSWU } from './abstract/weierstrass.js';\nconst secp256k1P = BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f');\nconst secp256k1N = BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141');\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst divNearest = (a, b) => (a + b / _2n) / b;\n/**\n * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit.\n * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00]\n */\nfunction sqrtMod(y) {\n const P = secp256k1P;\n // prettier-ignore\n const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);\n // prettier-ignore\n const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88);\n const b2 = (y * y * y) % P; // x^3, 11\n const b3 = (b2 * b2 * y) % P; // x^7\n const b6 = (pow2(b3, _3n, P) * b3) % P;\n const b9 = (pow2(b6, _3n, P) * b3) % P;\n const b11 = (pow2(b9, _2n, P) * b2) % P;\n const b22 = (pow2(b11, _11n, P) * b11) % P;\n const b44 = (pow2(b22, _22n, P) * b22) % P;\n const b88 = (pow2(b44, _44n, P) * b44) % P;\n const b176 = (pow2(b88, _88n, P) * b88) % P;\n const b220 = (pow2(b176, _44n, P) * b44) % P;\n const b223 = (pow2(b220, _3n, P) * b3) % P;\n const t1 = (pow2(b223, _23n, P) * b22) % P;\n const t2 = (pow2(t1, _6n, P) * b2) % P;\n const root = pow2(t2, _2n, P);\n if (!Fp.eql(Fp.sqr(root), y))\n throw new Error('Cannot find square root');\n return root;\n}\nconst Fp = Field(secp256k1P, undefined, undefined, { sqrt: sqrtMod });\n/**\n * secp256k1 short weierstrass curve and ECDSA signatures over it.\n */\nexport const secp256k1 = createCurve({\n a: BigInt(0), // equation params: a, b\n b: BigInt(7), // Seem to be rigid: bitcointalk.org/index.php?topic=289795.msg3183975#msg3183975\n Fp, // Field's prime: 2n**256n - 2n**32n - 2n**9n - 2n**8n - 2n**7n - 2n**6n - 2n**4n - 1n\n n: secp256k1N, // Curve order, total count of valid points in the field\n // Base point (x, y) aka generator point\n Gx: BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240'),\n Gy: BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424'),\n h: BigInt(1), // Cofactor\n lowS: true, // Allow only low-S signatures by default in sign() and verify()\n /**\n * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism.\n * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%.\n * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit.\n * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066\n */\n endo: {\n beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'),\n splitScalar: (k) => {\n const n = secp256k1N;\n const a1 = BigInt('0x3086d221a7d46bcde86c90e49284eb15');\n const b1 = -_1n * BigInt('0xe4437ed6010e88286f547fa90abfe4c3');\n const a2 = BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8');\n const b2 = a1;\n const POW_2_128 = BigInt('0x100000000000000000000000000000000'); // (2n**128n).toString(16)\n const c1 = divNearest(b2 * k, n);\n const c2 = divNearest(-b1 * k, n);\n let k1 = mod(k - c1 * a1 - c2 * a2, n);\n let k2 = mod(-c1 * b1 - c2 * b2, n);\n const k1neg = k1 > POW_2_128;\n const k2neg = k2 > POW_2_128;\n if (k1neg)\n k1 = n - k1;\n if (k2neg)\n k2 = n - k2;\n if (k1 > POW_2_128 || k2 > POW_2_128) {\n throw new Error('splitScalar: Endomorphism failed, k=' + k);\n }\n return { k1neg, k1, k2neg, k2 };\n },\n },\n}, sha256);\n// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code.\n// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki\nconst _0n = BigInt(0);\n/** An object mapping tags to their tagged hash prefix of [SHA256(tag) | SHA256(tag)] */\nconst TAGGED_HASH_PREFIXES = {};\nfunction taggedHash(tag, ...messages) {\n let tagP = TAGGED_HASH_PREFIXES[tag];\n if (tagP === undefined) {\n const tagH = sha256(Uint8Array.from(tag, (c) => c.charCodeAt(0)));\n tagP = concatBytes(tagH, tagH);\n TAGGED_HASH_PREFIXES[tag] = tagP;\n }\n return sha256(concatBytes(tagP, ...messages));\n}\n// ECDSA compact points are 33-byte. Schnorr is 32: we strip first byte 0x02 or 0x03\nconst pointToBytes = (point) => point.toRawBytes(true).slice(1);\nconst numTo32b = (n) => numberToBytesBE(n, 32);\nconst modP = (x) => mod(x, secp256k1P);\nconst modN = (x) => mod(x, secp256k1N);\nconst Point = secp256k1.ProjectivePoint;\nconst GmulAdd = (Q, a, b) => Point.BASE.multiplyAndAddUnsafe(Q, a, b);\n// Calculate point, scalar and bytes\nfunction schnorrGetExtPubKey(priv) {\n let d_ = secp256k1.utils.normPrivateKeyToScalar(priv); // same method executed in fromPrivateKey\n let p = Point.fromPrivateKey(d_); // P = d'⋅G; 0 < d' < n check is done inside\n const scalar = p.hasEvenY() ? d_ : modN(-d_);\n return { scalar: scalar, bytes: pointToBytes(p) };\n}\n/**\n * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point.\n * @returns valid point checked for being on-curve\n */\nfunction lift_x(x) {\n aInRange('x', x, _1n, secp256k1P); // Fail if x ≥ p.\n const xx = modP(x * x);\n const c = modP(xx * x + BigInt(7)); // Let c = x³ + 7 mod p.\n let y = sqrtMod(c); // Let y = c^(p+1)/4 mod p.\n if (y % _2n !== _0n)\n y = modP(-y); // Return the unique point P such that x(P) = x and\n const p = new Point(x, y, _1n); // y(P) = y if y mod 2 = 0 or y(P) = p-y otherwise.\n p.assertValidity();\n return p;\n}\nconst num = bytesToNumberBE;\n/**\n * Create tagged hash, convert it to bigint, reduce modulo-n.\n */\nfunction challenge(...args) {\n return modN(num(taggedHash('BIP0340/challenge', ...args)));\n}\n/**\n * Schnorr public key is just `x` coordinate of Point as per BIP340.\n */\nfunction schnorrGetPublicKey(privateKey) {\n return schnorrGetExtPubKey(privateKey).bytes; // d'=int(sk). Fail if d'=0 or d'≥n. Ret bytes(d'⋅G)\n}\n/**\n * Creates Schnorr signature as per BIP340. Verifies itself before returning anything.\n * auxRand is optional and is not the sole source of k generation: bad CSPRNG won't be dangerous.\n */\nfunction schnorrSign(message, privateKey, auxRand = randomBytes(32)) {\n const m = ensureBytes('message', message);\n const { bytes: px, scalar: d } = schnorrGetExtPubKey(privateKey); // checks for isWithinCurveOrder\n const a = ensureBytes('auxRand', auxRand, 32); // Auxiliary random data a: a 32-byte array\n const t = numTo32b(d ^ num(taggedHash('BIP0340/aux', a))); // Let t be the byte-wise xor of bytes(d) and hash/aux(a)\n const rand = taggedHash('BIP0340/nonce', t, px, m); // Let rand = hash/nonce(t || bytes(P) || m)\n const k_ = modN(num(rand)); // Let k' = int(rand) mod n\n if (k_ === _0n)\n throw new Error('sign failed: k is zero'); // Fail if k' = 0.\n const { bytes: rx, scalar: k } = schnorrGetExtPubKey(k_); // Let R = k'⋅G.\n const e = challenge(rx, px, m); // Let e = int(hash/challenge(bytes(R) || bytes(P) || m)) mod n.\n const sig = new Uint8Array(64); // Let sig = bytes(R) || bytes((k + ed) mod n).\n sig.set(rx, 0);\n sig.set(numTo32b(modN(k + e * d)), 32);\n // If Verify(bytes(P), m, sig) (see below) returns failure, abort\n if (!schnorrVerify(sig, m, px))\n throw new Error('sign: Invalid signature produced');\n return sig;\n}\n/**\n * Verifies Schnorr signature.\n * Will swallow errors & return false except for initial type validation of arguments.\n */\nfunction schnorrVerify(signature, message, publicKey) {\n const sig = ensureBytes('signature', signature, 64);\n const m = ensureBytes('message', message);\n const pub = ensureBytes('publicKey', publicKey, 32);\n try {\n const P = lift_x(num(pub)); // P = lift_x(int(pk)); fail if that fails\n const r = num(sig.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p.\n if (!inRange(r, _1n, secp256k1P))\n return false;\n const s = num(sig.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n.\n if (!inRange(s, _1n, secp256k1N))\n return false;\n const e = challenge(numTo32b(r), pointToBytes(P), m); // int(challenge(bytes(r)||bytes(P)||m))%n\n const R = GmulAdd(P, s, modN(-e)); // R = s⋅G - e⋅P\n if (!R || !R.hasEvenY() || R.toAffine().x !== r)\n return false; // -eP == (n-e)P\n return true; // Fail if is_infinite(R) / not has_even_y(R) / x(R) ≠ r.\n }\n catch (error) {\n return false;\n }\n}\n/**\n * Schnorr signatures over secp256k1.\n */\nexport const schnorr = /* @__PURE__ */ (() => ({\n getPublicKey: schnorrGetPublicKey,\n sign: schnorrSign,\n verify: schnorrVerify,\n utils: {\n randomPrivateKey: secp256k1.utils.randomPrivateKey,\n lift_x,\n pointToBytes,\n numberToBytesBE,\n bytesToNumberBE,\n taggedHash,\n mod,\n },\n}))();\nconst isoMap = /* @__PURE__ */ (() => isogenyMap(Fp, [\n // xNum\n [\n '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7',\n '0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581',\n '0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262',\n '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c',\n ],\n // xDen\n [\n '0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b',\n '0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14',\n '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1\n ],\n // yNum\n [\n '0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c',\n '0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3',\n '0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931',\n '0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84',\n ],\n // yDen\n [\n '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b',\n '0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573',\n '0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f',\n '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1\n ],\n].map((i) => i.map((j) => BigInt(j)))))();\nconst mapSWU = /* @__PURE__ */ (() => mapToCurveSimpleSWU(Fp, {\n A: BigInt('0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533'),\n B: BigInt('1771'),\n Z: Fp.create(BigInt('-11')),\n}))();\nconst htf = /* @__PURE__ */ (() => createHasher(secp256k1.ProjectivePoint, (scalars) => {\n const { x, y } = mapSWU(Fp.create(scalars[0]));\n return isoMap(x, y);\n}, {\n DST: 'secp256k1_XMD:SHA-256_SSWU_RO_',\n encodeDST: 'secp256k1_XMD:SHA-256_SSWU_NU_',\n p: Fp.ORDER,\n m: 1,\n k: 128,\n expand: 'xmd',\n hash: sha256,\n}))();\nexport const hashToCurve = /* @__PURE__ */ (() => htf.hashToCurve)();\nexport const encodeToCurve = /* @__PURE__ */ (() => htf.encodeToCurve)();\n//# sourceMappingURL=secp256k1.js.map","import { parseAccount, } from '../../accounts/utils/parseAccount.js';\nimport { AccountNotFoundError, } from '../../errors/account.js';\nimport { encodeFunctionData, } from '../../utils/abi/encodeFunctionData.js';\nimport { getContractError, } from '../../utils/errors/getContractError.js';\nimport { getAction } from '../../utils/getAction.js';\nimport { sendTransaction, } from './sendTransaction.js';\n/**\n * Executes a write function on a contract.\n *\n * - Docs: https://viem.sh/docs/contract/writeContract\n * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/writing-to-contracts\n *\n * A \"write\" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms) is needed to be broadcast in order to change the state.\n *\n * Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData).\n *\n * __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract#usage) before you execute it.__\n *\n * @param client - Client to use\n * @param parameters - {@link WriteContractParameters}\n * @returns A [Transaction Hash](https://viem.sh/docs/glossary/terms#hash). {@link WriteContractReturnType}\n *\n * @example\n * import { createWalletClient, custom, parseAbi } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { writeContract } from 'viem/contract'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n * const hash = await writeContract(client, {\n * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',\n * abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),\n * functionName: 'mint',\n * args: [69420],\n * })\n *\n * @example\n * // With Validation\n * import { createWalletClient, http, parseAbi } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { simulateContract, writeContract } from 'viem/contract'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: http(),\n * })\n * const { request } = await simulateContract(client, {\n * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',\n * abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),\n * functionName: 'mint',\n * args: [69420],\n * }\n * const hash = await writeContract(client, request)\n */\nexport async function writeContract(client, parameters) {\n const { abi, account: account_ = client.account, address, args, dataSuffix, functionName, ...request } = parameters;\n if (typeof account_ === 'undefined')\n throw new AccountNotFoundError({\n docsPath: '/docs/contract/writeContract',\n });\n const account = account_ ? parseAccount(account_) : null;\n const data = encodeFunctionData({\n abi,\n args,\n functionName,\n });\n try {\n return await getAction(client, sendTransaction, 'sendTransaction')({\n data: `${data}${dataSuffix ? dataSuffix.replace('0x', '') : ''}`,\n to: address,\n account,\n ...request,\n });\n }\n catch (error) {\n throw getContractError(error, {\n abi,\n address,\n args,\n docsPath: '/docs/contract/writeContract',\n functionName,\n sender: account?.address,\n });\n }\n}\n//# sourceMappingURL=writeContract.js.map","/**\n * Retrieves and returns an action from the client (if exists), and falls\n * back to the tree-shakable action.\n *\n * Useful for extracting overridden actions from a client (ie. if a consumer\n * wants to override the `sendTransaction` implementation).\n */\nexport function getAction(client, actionFn, \n// Some minifiers drop `Function.prototype.name`, or replace it with short letters,\n// meaning that `actionFn.name` will not always work. For that case, the consumer\n// needs to pass the name explicitly.\nname) {\n const action_implicit = client[actionFn.name];\n if (typeof action_implicit === 'function')\n return action_implicit;\n const action_explicit = client[name];\n if (typeof action_explicit === 'function')\n return action_explicit;\n return (params) => actionFn(client, params);\n}\n//# sourceMappingURL=getAction.js.map","export const version = '2.14.1';\n//# sourceMappingURL=version.js.map","import { version } from '../version.js';\nexport const getVersion = () => `@wagmi/core@${version}`;\n//# sourceMappingURL=getVersion.js.map","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _BaseError_instances, _BaseError_walk;\nimport { getVersion } from '../utils/getVersion.js';\nexport class BaseError extends Error {\n get docsBaseUrl() {\n return 'https://wagmi.sh/core';\n }\n get version() {\n return getVersion();\n }\n constructor(shortMessage, options = {}) {\n super();\n _BaseError_instances.add(this);\n Object.defineProperty(this, \"details\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"docsPath\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"metaMessages\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"shortMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'WagmiCoreError'\n });\n const details = options.cause instanceof BaseError\n ? options.cause.details\n : options.cause?.message\n ? options.cause.message\n : options.details;\n const docsPath = options.cause instanceof BaseError\n ? options.cause.docsPath || options.docsPath\n : options.docsPath;\n this.message = [\n shortMessage || 'An error occurred.',\n '',\n ...(options.metaMessages ? [...options.metaMessages, ''] : []),\n ...(docsPath\n ? [\n `Docs: ${this.docsBaseUrl}${docsPath}.html${options.docsSlug ? `#${options.docsSlug}` : ''}`,\n ]\n : []),\n ...(details ? [`Details: ${details}`] : []),\n `Version: ${this.version}`,\n ].join('\\n');\n if (options.cause)\n this.cause = options.cause;\n this.details = details;\n this.docsPath = docsPath;\n this.metaMessages = options.metaMessages;\n this.shortMessage = shortMessage;\n }\n walk(fn) {\n return __classPrivateFieldGet(this, _BaseError_instances, \"m\", _BaseError_walk).call(this, this, fn);\n }\n}\n_BaseError_instances = new WeakSet(), _BaseError_walk = function _BaseError_walk(err, fn) {\n if (fn?.(err))\n return err;\n if (err.cause)\n return __classPrivateFieldGet(this, _BaseError_instances, \"m\", _BaseError_walk).call(this, err.cause, fn);\n return err;\n};\n//# sourceMappingURL=base.js.map","import { BaseError } from './base.js';\nexport class ChainNotConfiguredError extends BaseError {\n constructor() {\n super('Chain not configured.');\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'ChainNotConfiguredError'\n });\n }\n}\nexport class ConnectorAlreadyConnectedError extends BaseError {\n constructor() {\n super('Connector already connected.');\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'ConnectorAlreadyConnectedError'\n });\n }\n}\nexport class ConnectorNotConnectedError extends BaseError {\n constructor() {\n super('Connector not connected.');\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'ConnectorNotConnectedError'\n });\n }\n}\nexport class ConnectorNotFoundError extends BaseError {\n constructor() {\n super('Connector not found.');\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'ConnectorNotFoundError'\n });\n }\n}\nexport class ConnectorAccountNotFoundError extends BaseError {\n constructor({ address, connector, }) {\n super(`Account \"${address}\" not found for connector \"${connector.name}\".`);\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'ConnectorAccountNotFoundError'\n });\n }\n}\nexport class ConnectorChainMismatchError extends BaseError {\n constructor({ connectionChainId, connectorChainId, }) {\n super(`The current chain of the connector (id: ${connectorChainId}) does not match the connection's chain (id: ${connectionChainId}).`, {\n metaMessages: [\n `Current Chain ID: ${connectorChainId}`,\n `Expected Chain ID: ${connectionChainId}`,\n ],\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'ConnectorChainMismatchError'\n });\n }\n}\nexport class ConnectorUnavailableReconnectingError extends BaseError {\n constructor({ connector }) {\n super(`Connector \"${connector.name}\" unavailable while reconnecting.`, {\n details: [\n 'During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`.',\n 'All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.',\n 'This error commonly occurs for connectors that asynchronously inject after reconnection has already started.',\n ].join(' '),\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'ConnectorUnavailableReconnectingError'\n });\n }\n}\n//# sourceMappingURL=config.js.map","import { ConnectorAlreadyConnectedError, } from '../errors/config.js';\n/** https://wagmi.sh/core/api/actions/connect */\nexport async function connect(config, parameters) {\n // \"Register\" connector if not already created\n let connector;\n if (typeof parameters.connector === 'function') {\n connector = config._internal.connectors.setup(parameters.connector);\n }\n else\n connector = parameters.connector;\n // Check if connector is already connected\n if (connector.uid === config.state.current)\n throw new ConnectorAlreadyConnectedError();\n try {\n config.setState((x) => ({ ...x, status: 'connecting' }));\n connector.emitter.emit('message', { type: 'connecting' });\n const data = await connector.connect({ chainId: parameters.chainId });\n const accounts = data.accounts;\n connector.emitter.off('connect', config._internal.events.connect);\n connector.emitter.on('change', config._internal.events.change);\n connector.emitter.on('disconnect', config._internal.events.disconnect);\n await config.storage?.setItem('recentConnectorId', connector.id);\n config.setState((x) => ({\n ...x,\n connections: new Map(x.connections).set(connector.uid, {\n accounts,\n chainId: data.chainId,\n connector: connector,\n }),\n current: connector.uid,\n status: 'connected',\n }));\n return { accounts, chainId: data.chainId };\n }\n catch (error) {\n config.setState((x) => ({\n ...x,\n // Keep existing connector connected in case of error\n status: x.current ? 'connected' : 'disconnected',\n }));\n throw error;\n }\n}\n//# sourceMappingURL=connect.js.map","const size = 256;\nlet index = size;\nlet buffer;\nexport function uid(length = 11) {\n if (!buffer || index + length > size * 2) {\n buffer = '';\n index = 0;\n for (let i = 0; i < size; i++) {\n buffer += ((256 + Math.random() * 256) | 0).toString(16).substring(1);\n }\n }\n return buffer.substring(index, index++ + length);\n}\n//# sourceMappingURL=uid.js.map","import { parseAccount, } from '../accounts/utils/parseAccount.js';\nimport { uid } from '../utils/uid.js';\nexport function createClient(parameters) {\n const { batch, cacheTime = parameters.pollingInterval ?? 4_000, ccipRead, key = 'base', name = 'Base Client', pollingInterval = 4_000, type = 'base', } = parameters;\n const chain = parameters.chain;\n const account = parameters.account\n ? parseAccount(parameters.account)\n : undefined;\n const { config, request, value } = parameters.transport({\n chain,\n pollingInterval,\n });\n const transport = { ...config, ...value };\n const client = {\n account,\n batch,\n cacheTime,\n ccipRead,\n chain,\n key,\n name,\n pollingInterval,\n request,\n transport,\n type,\n uid: uid(),\n };\n function extend(base) {\n return (extendFn) => {\n const extended = extendFn(base);\n for (const key in client)\n delete extended[key];\n const combined = { ...base, ...extended };\n return Object.assign(combined, { extend: extend(combined) });\n };\n }\n return Object.assign(client, { extend: extend(client) });\n}\n/**\n * Defines a typed JSON-RPC schema for the client.\n * Note: This is a runtime noop function.\n */\nexport function rpcSchema() {\n return null;\n}\n//# sourceMappingURL=createClient.js.map","import { buildRequest } from '../../utils/buildRequest.js';\nimport { uid as uid_ } from '../../utils/uid.js';\n/**\n * @description Creates an transport intended to be used with a client.\n */\nexport function createTransport({ key, name, request, retryCount = 3, retryDelay = 150, timeout, type, }, value) {\n const uid = uid_();\n return {\n config: {\n key,\n name,\n request,\n retryCount,\n retryDelay,\n timeout,\n type,\n },\n request: buildRequest(request, { retryCount, retryDelay, uid }),\n value,\n };\n}\n//# sourceMappingURL=createTransport.js.map","import { createTransport, } from './createTransport.js';\n/**\n * @description Creates a custom transport given an EIP-1193 compliant `request` attribute.\n */\nexport function custom(provider, config = {}) {\n const { key = 'custom', name = 'Custom Provider', retryDelay } = config;\n return ({ retryCount: defaultRetryCount }) => createTransport({\n key,\n name,\n request: provider.request.bind(provider),\n retryCount: config.retryCount ?? defaultRetryCount,\n retryDelay,\n type: 'custom',\n });\n}\n//# sourceMappingURL=custom.js.map","import { TransactionRejectedRpcError, UserRejectedRequestError, } from '../../errors/rpc.js';\nimport { wait } from '../../utils/wait.js';\nimport { createTransport, } from './createTransport.js';\nexport function fallback(transports_, config = {}) {\n const { key = 'fallback', name = 'Fallback', rank = false, retryCount, retryDelay, } = config;\n return (({ chain, pollingInterval = 4_000, timeout, ...rest }) => {\n let transports = transports_;\n let onResponse = () => { };\n const transport = createTransport({\n key,\n name,\n async request({ method, params }) {\n const fetch = async (i = 0) => {\n const transport = transports[i]({\n ...rest,\n chain,\n retryCount: 0,\n timeout,\n });\n try {\n const response = await transport.request({\n method,\n params,\n });\n onResponse({\n method,\n params: params,\n response,\n transport,\n status: 'success',\n });\n return response;\n }\n catch (err) {\n onResponse({\n error: err,\n method,\n params: params,\n transport,\n status: 'error',\n });\n if (shouldThrow(err))\n throw err;\n // If we've reached the end of the fallbacks, throw the error.\n if (i === transports.length - 1)\n throw err;\n // Otherwise, try the next fallback.\n return fetch(i + 1);\n }\n };\n return fetch();\n },\n retryCount,\n retryDelay,\n type: 'fallback',\n }, {\n onResponse: (fn) => (onResponse = fn),\n transports: transports.map((fn) => fn({ chain, retryCount: 0 })),\n });\n if (rank) {\n const rankOptions = (typeof rank === 'object' ? rank : {});\n rankTransports({\n chain,\n interval: rankOptions.interval ?? pollingInterval,\n onTransports: (transports_) => (transports = transports_),\n sampleCount: rankOptions.sampleCount,\n timeout: rankOptions.timeout,\n transports,\n weights: rankOptions.weights,\n });\n }\n return transport;\n });\n}\nfunction shouldThrow(error) {\n if ('code' in error && typeof error.code === 'number') {\n if (error.code === TransactionRejectedRpcError.code ||\n error.code === UserRejectedRequestError.code ||\n error.code === 5000 // CAIP UserRejectedRequestError\n )\n return true;\n }\n return false;\n}\n/** @internal */\nexport function rankTransports({ chain, interval = 4_000, onTransports, sampleCount = 10, timeout = 1_000, transports, weights = {}, }) {\n const { stability: stabilityWeight = 0.7, latency: latencyWeight = 0.3 } = weights;\n const samples = [];\n const rankTransports_ = async () => {\n // 1. Take a sample from each Transport.\n const sample = await Promise.all(transports.map(async (transport) => {\n const transport_ = transport({ chain, retryCount: 0, timeout });\n const start = Date.now();\n let end;\n let success;\n try {\n await transport_.request({ method: 'net_listening' });\n success = 1;\n }\n catch {\n success = 0;\n }\n finally {\n end = Date.now();\n }\n const latency = end - start;\n return { latency, success };\n }));\n // 2. Store the sample. If we have more than `sampleCount` samples, remove\n // the oldest sample.\n samples.push(sample);\n if (samples.length > sampleCount)\n samples.shift();\n // 3. Calculate the max latency from samples.\n const maxLatency = Math.max(...samples.map((sample) => Math.max(...sample.map(({ latency }) => latency))));\n // 4. Calculate the score for each Transport.\n const scores = transports\n .map((_, i) => {\n const latencies = samples.map((sample) => sample[i].latency);\n const meanLatency = latencies.reduce((acc, latency) => acc + latency, 0) /\n latencies.length;\n const latencyScore = 1 - meanLatency / maxLatency;\n const successes = samples.map((sample) => sample[i].success);\n const stabilityScore = successes.reduce((acc, success) => acc + success, 0) /\n successes.length;\n if (stabilityScore === 0)\n return [0, i];\n return [\n latencyWeight * latencyScore + stabilityWeight * stabilityScore,\n i,\n ];\n })\n .sort((a, b) => b[0] - a[0]);\n // 5. Sort the Transports by score.\n onTransports(scores.map(([, i]) => transports[i]));\n // 6. Wait, and then rank again.\n await wait(interval);\n rankTransports_();\n };\n rankTransports_();\n}\n//# sourceMappingURL=fallback.js.map","import { BaseError } from './base.js';\nexport class UrlRequiredError extends BaseError {\n constructor() {\n super('No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.', {\n docsPath: '/docs/clients/intro',\n name: 'UrlRequiredError',\n });\n }\n}\n//# sourceMappingURL=transport.js.map","import { RpcRequestError } from '../../errors/request.js';\nimport { UrlRequiredError, } from '../../errors/transport.js';\nimport { createBatchScheduler } from '../../utils/promise/createBatchScheduler.js';\nimport { getHttpRpcClient, } from '../../utils/rpc/http.js';\nimport { createTransport, } from './createTransport.js';\n/**\n * @description Creates a HTTP transport that connects to a JSON-RPC API.\n */\nexport function http(\n/** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */\nurl, config = {}) {\n const { batch, fetchOptions, key = 'http', name = 'HTTP JSON-RPC', onFetchRequest, onFetchResponse, retryDelay, } = config;\n return ({ chain, retryCount: retryCount_, timeout: timeout_ }) => {\n const { batchSize = 1000, wait = 0 } = typeof batch === 'object' ? batch : {};\n const retryCount = config.retryCount ?? retryCount_;\n const timeout = timeout_ ?? config.timeout ?? 10_000;\n const url_ = url || chain?.rpcUrls.default.http[0];\n if (!url_)\n throw new UrlRequiredError();\n const rpcClient = getHttpRpcClient(url_, {\n fetchOptions,\n onRequest: onFetchRequest,\n onResponse: onFetchResponse,\n timeout,\n });\n return createTransport({\n key,\n name,\n async request({ method, params }) {\n const body = { method, params };\n const { schedule } = createBatchScheduler({\n id: url_,\n wait,\n shouldSplitBatch(requests) {\n return requests.length > batchSize;\n },\n fn: (body) => rpcClient.request({\n body,\n }),\n sort: (a, b) => a.id - b.id,\n });\n const fn = async (body) => batch\n ? schedule(body)\n : [\n await rpcClient.request({\n body,\n }),\n ];\n const [{ error, result }] = await fn(body);\n if (error)\n throw new RpcRequestError({\n body,\n error,\n url: url_,\n });\n return result;\n },\n retryCount,\n retryDelay,\n timeout,\n type: 'http',\n }, {\n fetchOptions,\n url: url_,\n });\n };\n}\n//# sourceMappingURL=http.js.map","import { createClient, custom, } from 'viem';\nimport { getAddress, parseAccount } from 'viem/utils';\nimport { ConnectorAccountNotFoundError, ConnectorChainMismatchError, ConnectorNotConnectedError, ConnectorUnavailableReconnectingError, } from '../errors/config.js';\n/** https://wagmi.sh/core/api/actions/getConnectorClient */\nexport async function getConnectorClient(config, parameters = {}) {\n // Get connection\n let connection;\n if (parameters.connector) {\n const { connector } = parameters;\n if (config.state.status === 'reconnecting' &&\n !connector.getAccounts &&\n !connector.getChainId)\n throw new ConnectorUnavailableReconnectingError({ connector });\n const [accounts, chainId] = await Promise.all([\n connector.getAccounts(),\n connector.getChainId(),\n ]);\n connection = {\n accounts: accounts,\n chainId,\n connector,\n };\n }\n else\n connection = config.state.connections.get(config.state.current);\n if (!connection)\n throw new ConnectorNotConnectedError();\n const chainId = parameters.chainId ?? connection.chainId;\n // Check connector using same chainId as connection\n const connectorChainId = await connection.connector.getChainId();\n if (connectorChainId !== connection.chainId)\n throw new ConnectorChainMismatchError({\n connectionChainId: connection.chainId,\n connectorChainId,\n });\n const connector = connection.connector;\n if (connector.getClient)\n return connector.getClient({ chainId });\n // Default using `custom` transport\n const account = parseAccount(parameters.account ?? connection.accounts[0]);\n account.address = getAddress(account.address); // TODO: Checksum address as part of `parseAccount`?\n // If account was provided, check that it exists on the connector\n if (parameters.account &&\n !connection.accounts.some((x) => x.toLowerCase() === account.address.toLowerCase()))\n throw new ConnectorAccountNotFoundError({\n address: account.address,\n connector,\n });\n const chain = config.chains.find((chain) => chain.id === chainId);\n const provider = (await connection.connector.getProvider({ chainId }));\n return createClient({\n account,\n chain,\n name: 'Connector Client',\n transport: (opts) => custom(provider)({ ...opts, retryCount: 0 }),\n });\n}\n//# sourceMappingURL=getConnectorClient.js.map","/** https://wagmi.sh/core/api/actions/disconnect */\nexport async function disconnect(config, parameters = {}) {\n let connector;\n if (parameters.connector)\n connector = parameters.connector;\n else {\n const { connections, current } = config.state;\n const connection = connections.get(current);\n connector = connection?.connector;\n }\n const connections = config.state.connections;\n if (connector) {\n await connector.disconnect();\n connector.emitter.off('change', config._internal.events.change);\n connector.emitter.off('disconnect', config._internal.events.disconnect);\n connector.emitter.on('connect', config._internal.events.connect);\n connections.delete(connector.uid);\n }\n config.setState((x) => {\n // if no connections exist, move to disconnected state\n if (connections.size === 0)\n return {\n ...x,\n connections: new Map(),\n current: null,\n status: 'disconnected',\n };\n // switch over to another connection\n const nextConnection = connections.values().next().value;\n return {\n ...x,\n connections: new Map(connections),\n current: nextConnection.connector.uid,\n };\n });\n // Set recent connector if exists\n {\n const current = config.state.current;\n if (!current)\n return;\n const connector = config.state.connections.get(current)?.connector;\n if (!connector)\n return;\n await config.storage?.setItem('recentConnectorId', connector.id);\n }\n}\n//# sourceMappingURL=disconnect.js.map","import { estimateGas as viem_estimateGas, } from 'viem/actions';\nimport { getAction } from '../utils/getAction.js';\nimport { getConnectorClient, } from './getConnectorClient.js';\n/** https://wagmi.sh/core/api/actions/estimateGas */\nexport async function estimateGas(config, parameters) {\n const { chainId, connector, ...rest } = parameters;\n let account;\n if (parameters.account)\n account = parameters.account;\n else {\n const connectorClient = await getConnectorClient(config, {\n account: parameters.account,\n chainId,\n connector,\n });\n account = connectorClient.account;\n }\n const client = config.getClient({ chainId });\n const action = getAction(client, viem_estimateGas, 'estimateGas');\n return action({ ...rest, account });\n}\n//# sourceMappingURL=estimateGas.js.map","import { weiUnits } from 'viem';\nexport function getUnit(unit) {\n if (typeof unit === 'number')\n return unit;\n if (unit === 'wei')\n return 0;\n return Math.abs(weiUnits[unit]);\n}\n//# sourceMappingURL=getUnit.js.map","/** https://wagmi.sh/core/api/actions/getAccount */\nexport function getAccount(config) {\n const uid = config.state.current;\n const connection = config.state.connections.get(uid);\n const addresses = connection?.accounts;\n const address = addresses?.[0];\n const chain = config.chains.find((chain) => chain.id === connection?.chainId);\n const status = config.state.status;\n switch (status) {\n case 'connected':\n return {\n address: address,\n addresses: addresses,\n chain,\n chainId: connection?.chainId,\n connector: connection?.connector,\n isConnected: true,\n isConnecting: false,\n isDisconnected: false,\n isReconnecting: false,\n status,\n };\n case 'reconnecting':\n return {\n address,\n addresses,\n chain,\n chainId: connection?.chainId,\n connector: connection?.connector,\n isConnected: !!address,\n isConnecting: false,\n isDisconnected: false,\n isReconnecting: true,\n status,\n };\n case 'connecting':\n return {\n address,\n addresses,\n chain,\n chainId: connection?.chainId,\n connector: connection?.connector,\n isConnected: false,\n isConnecting: true,\n isDisconnected: false,\n isReconnecting: false,\n status,\n };\n case 'disconnected':\n return {\n address: undefined,\n addresses: undefined,\n chain: undefined,\n chainId: undefined,\n connector: undefined,\n isConnected: false,\n isConnecting: false,\n isDisconnected: true,\n isReconnecting: false,\n status,\n };\n }\n}\n//# sourceMappingURL=getAccount.js.map","import { multicall as viem_multicall } from 'viem/actions';\nimport { getAction } from '../utils/getAction.js';\nexport async function multicall(config, parameters) {\n const { allowFailure = true, chainId, contracts, ...rest } = parameters;\n const client = config.getClient({ chainId });\n const action = getAction(client, viem_multicall, 'multicall');\n return action({\n allowFailure,\n contracts,\n ...rest,\n });\n}\n//# sourceMappingURL=multicall.js.map","import { readContract as viem_readContract, } from 'viem/actions';\nimport { getAction } from '../utils/getAction.js';\n/** https://wagmi.sh/core/api/actions/readContract */\nexport function readContract(config, parameters) {\n const { chainId, ...rest } = parameters;\n const client = config.getClient({ chainId });\n const action = getAction(client, viem_readContract, 'readContract');\n return action(rest);\n}\n//# sourceMappingURL=readContract.js.map","import { ContractFunctionExecutionError } from 'viem';\nimport { multicall } from './multicall.js';\nimport { readContract } from './readContract.js';\nexport async function readContracts(config, parameters) {\n const { allowFailure = true, blockNumber, blockTag, ...rest } = parameters;\n const contracts = parameters.contracts;\n try {\n const contractsByChainId = {};\n for (const [index, contract] of contracts.entries()) {\n const chainId = contract.chainId ?? config.state.chainId;\n if (!contractsByChainId[chainId])\n contractsByChainId[chainId] = [];\n contractsByChainId[chainId]?.push({ contract, index });\n }\n const promises = () => Object.entries(contractsByChainId).map(([chainId, contracts]) => multicall(config, {\n ...rest,\n allowFailure,\n blockNumber,\n blockTag,\n chainId: Number.parseInt(chainId),\n contracts: contracts.map(({ contract }) => contract),\n }));\n const multicallResults = (await Promise.all(promises())).flat();\n // Reorder the contract results back to the order they were\n // provided in.\n const resultIndexes = Object.values(contractsByChainId).flatMap((contracts) => contracts.map(({ index }) => index));\n return multicallResults.reduce((results, result, index) => {\n if (results)\n results[resultIndexes[index]] = result;\n return results;\n }, []);\n }\n catch (error) {\n if (error instanceof ContractFunctionExecutionError)\n throw error;\n const promises = () => contracts.map((contract) => readContract(config, { ...contract, blockNumber, blockTag }));\n if (allowFailure)\n return (await Promise.allSettled(promises())).map((result) => {\n if (result.status === 'fulfilled')\n return { result: result.value, status: 'success' };\n return { error: result.reason, result: undefined, status: 'failure' };\n });\n return (await Promise.all(promises()));\n }\n}\n//# sourceMappingURL=readContracts.js.map","import { ContractFunctionExecutionError, formatUnits, hexToString, trim, } from 'viem';\nimport { getBalance as viem_getBalance, } from 'viem/actions';\nimport { getAction } from '../utils/getAction.js';\nimport { getUnit } from '../utils/getUnit.js';\nimport { readContracts } from './readContracts.js';\n/** https://wagmi.sh/core/api/actions/getBalance */\nexport async function getBalance(config, parameters) {\n const { address, blockNumber, blockTag, chainId, token: tokenAddress, unit = 'ether', } = parameters;\n if (tokenAddress) {\n try {\n return getTokenBalance(config, {\n balanceAddress: address,\n chainId,\n symbolType: 'string',\n tokenAddress,\n });\n }\n catch (error) {\n // In the chance that there is an error upon decoding the contract result,\n // it could be likely that the contract data is represented as bytes32 instead\n // of a string.\n if (error instanceof ContractFunctionExecutionError) {\n const balance = await getTokenBalance(config, {\n balanceAddress: address,\n chainId,\n symbolType: 'bytes32',\n tokenAddress,\n });\n const symbol = hexToString(trim(balance.symbol, { dir: 'right' }));\n return { ...balance, symbol };\n }\n throw error;\n }\n }\n const client = config.getClient({ chainId });\n const action = getAction(client, viem_getBalance, 'getBalance');\n const value = await action(blockNumber ? { address, blockNumber } : { address, blockTag });\n const chain = config.chains.find((x) => x.id === chainId) ?? client.chain;\n return {\n decimals: chain.nativeCurrency.decimals,\n formatted: formatUnits(value, getUnit(unit)),\n symbol: chain.nativeCurrency.symbol,\n value,\n };\n}\nasync function getTokenBalance(config, parameters) {\n const { balanceAddress, chainId, symbolType, tokenAddress, unit } = parameters;\n const contract = {\n abi: [\n {\n type: 'function',\n name: 'balanceOf',\n stateMutability: 'view',\n inputs: [{ type: 'address' }],\n outputs: [{ type: 'uint256' }],\n },\n {\n type: 'function',\n name: 'decimals',\n stateMutability: 'view',\n inputs: [],\n outputs: [{ type: 'uint8' }],\n },\n {\n type: 'function',\n name: 'symbol',\n stateMutability: 'view',\n inputs: [],\n outputs: [{ type: symbolType }],\n },\n ],\n address: tokenAddress,\n };\n const [value, decimals, symbol] = await readContracts(config, {\n allowFailure: false,\n contracts: [\n {\n ...contract,\n functionName: 'balanceOf',\n args: [balanceAddress],\n chainId,\n },\n { ...contract, functionName: 'decimals', chainId },\n { ...contract, functionName: 'symbol', chainId },\n ],\n });\n const formatted = formatUnits(value ?? '0', getUnit(unit ?? decimals));\n return { decimals, formatted, symbol, value };\n}\n//# sourceMappingURL=getBalance.js.map","/** https://wagmi.sh/core/api/actions/getChainId */\nexport function getChainId(config) {\n return config.state.chainId;\n}\n//# sourceMappingURL=getChainId.js.map","/** Forked from https://github.com/epoberezkin/fast-deep-equal */\nexport function deepEqual(a, b) {\n if (a === b)\n return true;\n if (a && b && typeof a === 'object' && typeof b === 'object') {\n if (a.constructor !== b.constructor)\n return false;\n let length;\n let i;\n if (Array.isArray(a) && Array.isArray(b)) {\n length = a.length;\n if (length !== b.length)\n return false;\n for (i = length; i-- !== 0;)\n if (!deepEqual(a[i], b[i]))\n return false;\n return true;\n }\n if (a.valueOf !== Object.prototype.valueOf)\n return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString)\n return a.toString() === b.toString();\n const keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length)\n return false;\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i]))\n return false;\n for (i = length; i-- !== 0;) {\n const key = keys[i];\n if (key && !deepEqual(a[key], b[key]))\n return false;\n }\n return true;\n }\n // true if both NaN, false otherwise\n // biome-ignore lint/suspicious/noSelfCompare: \n return a !== a && b !== b;\n}\n//# sourceMappingURL=deepEqual.js.map","import { deepEqual } from '../utils/deepEqual.js';\nlet previousConnections = [];\n/** https://wagmi.sh/core/api/actions/getConnections */\nexport function getConnections(config) {\n const connections = [...config.state.connections.values()];\n if (config.state.status === 'reconnecting')\n return previousConnections;\n if (deepEqual(previousConnections, connections))\n return previousConnections;\n previousConnections = connections;\n return connections;\n}\n//# sourceMappingURL=getConnections.js.map","import { deepEqual } from '../utils/deepEqual.js';\nlet previousConnectors = [];\n/** https://wagmi.sh/core/api/actions/getConnectors */\nexport function getConnectors(config) {\n const connectors = config.connectors;\n if (deepEqual(previousConnectors, connectors))\n return previousConnectors;\n previousConnectors = connectors;\n return connectors;\n}\n//# sourceMappingURL=getConnectors.js.map","import { getEnsAddress as viem_getEnsAddress, } from 'viem/actions';\nimport { getAction } from '../utils/getAction.js';\n/** https://wagmi.sh/core/api/actions/getEnsAddress */\nexport function getEnsAddress(config, parameters) {\n const { chainId, ...rest } = parameters;\n const client = config.getClient({ chainId });\n const action = getAction(client, viem_getEnsAddress, 'getEnsAddress');\n return action(rest);\n}\n//# sourceMappingURL=getEnsAddress.js.map","import { getEnsAvatar as viem_getEnsAvatar, } from 'viem/actions';\nimport { getAction } from '../utils/getAction.js';\n/** https://wagmi.sh/core/api/actions/getEnsAvatar */\nexport function getEnsAvatar(config, parameters) {\n const { chainId, ...rest } = parameters;\n const client = config.getClient({ chainId });\n const action = getAction(client, viem_getEnsAvatar, 'getEnsAvatar');\n return action(rest);\n}\n//# sourceMappingURL=getEnsAvatar.js.map","import { getEnsName as viem_getEnsName, } from 'viem/actions';\nimport { getAction } from '../utils/getAction.js';\n/** https://wagmi.sh/core/api/actions/getEnsName */\nexport function getEnsName(config, parameters) {\n const { chainId, ...rest } = parameters;\n const client = config.getClient({ chainId });\n const action = getAction(client, viem_getEnsName, 'getEnsName');\n return action(rest);\n}\n//# sourceMappingURL=getEnsName.js.map","import { prepareTransactionRequest as viem_prepareTransactionRequest } from 'viem/actions';\nimport { getAction } from '../utils/getAction.js';\nimport { getAccount } from './getAccount.js';\n/** https://wagmi.sh/core/api/actions/prepareTransactionRequest */\nexport async function prepareTransactionRequest(config, parameters) {\n const { account: account_, chainId, ...rest } = parameters;\n const account = account_ ?? getAccount(config).address;\n const client = config.getClient({ chainId });\n const action = getAction(client, viem_prepareTransactionRequest, 'prepareTransactionRequest');\n return action({\n ...rest,\n ...(account ? { account } : {}),\n });\n}\n//# sourceMappingURL=prepareTransactionRequest.js.map","let isReconnecting = false;\n/** https://wagmi.sh/core/api/actions/reconnect */\nexport async function reconnect(config, parameters = {}) {\n // If already reconnecting, do nothing\n if (isReconnecting)\n return [];\n isReconnecting = true;\n config.setState((x) => ({\n ...x,\n status: x.current ? 'reconnecting' : 'connecting',\n }));\n const connectors = [];\n if (parameters.connectors?.length) {\n for (const connector_ of parameters.connectors) {\n let connector;\n // \"Register\" connector if not already created\n if (typeof connector_ === 'function')\n connector = config._internal.connectors.setup(connector_);\n else\n connector = connector_;\n connectors.push(connector);\n }\n }\n else\n connectors.push(...config.connectors);\n // Try recently-used connectors first\n let recentConnectorId;\n try {\n recentConnectorId = await config.storage?.getItem('recentConnectorId');\n }\n catch { }\n const scores = {};\n for (const [, connection] of config.state.connections) {\n scores[connection.connector.id] = 1;\n }\n if (recentConnectorId)\n scores[recentConnectorId] = 0;\n const sorted = Object.keys(scores).length > 0\n ? // .toSorted()\n [...connectors].sort((a, b) => (scores[a.id] ?? 10) - (scores[b.id] ?? 10))\n : connectors;\n // Iterate through each connector and try to connect\n let connected = false;\n const connections = [];\n const providers = [];\n for (const connector of sorted) {\n const provider = await connector.getProvider().catch(() => undefined);\n if (!provider)\n continue;\n // If we already have an instance of this connector's provider,\n // then we have already checked it (ie. injected connectors can\n // share the same `window.ethereum` instance, so we don't want to\n // connect to it again).\n if (providers.some((x) => x === provider))\n continue;\n const isAuthorized = await connector.isAuthorized();\n if (!isAuthorized)\n continue;\n const data = await connector\n .connect({ isReconnecting: true })\n .catch(() => null);\n if (!data)\n continue;\n connector.emitter.off('connect', config._internal.events.connect);\n connector.emitter.on('change', config._internal.events.change);\n connector.emitter.on('disconnect', config._internal.events.disconnect);\n config.setState((x) => {\n const connections = new Map(connected ? x.connections : new Map()).set(connector.uid, { accounts: data.accounts, chainId: data.chainId, connector });\n return {\n ...x,\n current: connected ? x.current : connector.uid,\n connections,\n };\n });\n connections.push({\n accounts: data.accounts,\n chainId: data.chainId,\n connector,\n });\n providers.push(provider);\n connected = true;\n }\n // Prevent overwriting connected status from race condition\n if (config.state.status === 'reconnecting' ||\n config.state.status === 'connecting') {\n // If connecting didn't succeed, set to disconnected\n if (!connected)\n config.setState((x) => ({\n ...x,\n connections: new Map(),\n current: null,\n status: 'disconnected',\n }));\n else\n config.setState((x) => ({ ...x, status: 'connected' }));\n }\n isReconnecting = false;\n return connections;\n}\n//# sourceMappingURL=reconnect.js.map","import { estimateGas as viem_estimateGas, sendTransaction as viem_sendTransaction, } from 'viem/actions';\nimport { getAction } from '../utils/getAction.js';\nimport { getAccount } from './getAccount.js';\nimport { getConnectorClient, } from './getConnectorClient.js';\n/** https://wagmi.sh/core/api/actions/sendTransaction */\nexport async function sendTransaction(config, parameters) {\n const { account, chainId, connector, gas: gas_, ...rest } = parameters;\n let client;\n if (typeof account === 'object' && account?.type === 'local')\n client = config.getClient({ chainId });\n else\n client = await getConnectorClient(config, {\n account: account ?? undefined,\n chainId,\n connector,\n });\n const { connector: activeConnector } = getAccount(config);\n const gas = await (async () => {\n // Skip gas estimation if `data` doesn't exist (not a contract interaction).\n if (!('data' in parameters) || !parameters.data)\n return undefined;\n // Skip gas estimation if connector supports simulation.\n if ((connector ?? activeConnector)?.supportsSimulation)\n return undefined;\n // Skip gas estimation if `null` is provided.\n if (gas_ === null)\n return undefined;\n // Run gas estimation if no value is provided.\n if (gas_ === undefined) {\n const action = getAction(client, viem_estimateGas, 'estimateGas');\n return action({\n ...rest,\n account,\n chain: chainId ? { id: chainId } : null,\n });\n }\n // Use provided gas value.\n return gas_;\n })();\n const action = getAction(client, viem_sendTransaction, 'sendTransaction');\n const hash = await action({\n ...rest,\n ...(account ? { account } : {}),\n gas,\n chain: chainId ? { id: chainId } : null,\n });\n return hash;\n}\n//# sourceMappingURL=sendTransaction.js.map","import { signMessage as viem_signMessage, } from 'viem/actions';\nimport { getAction } from '../utils/getAction.js';\nimport { getConnectorClient, } from './getConnectorClient.js';\n/** https://wagmi.sh/core/api/actions/signMessage */\nexport async function signMessage(config, parameters) {\n const { account, connector, ...rest } = parameters;\n let client;\n if (typeof account === 'object' && account.type === 'local')\n client = config.getClient();\n else\n client = await getConnectorClient(config, { account, connector });\n const action = getAction(client, viem_signMessage, 'signMessage');\n return action({\n ...rest,\n ...(account ? { account } : {}),\n });\n}\n//# sourceMappingURL=signMessage.js.map","import { simulateContract as viem_simulateContract, } from 'viem/actions';\nimport { getAction } from '../utils/getAction.js';\nimport { getConnectorClient, } from './getConnectorClient.js';\n/** https://wagmi.sh/core/api/actions/simulateContract */\nexport async function simulateContract(config, parameters) {\n const { abi, chainId, connector, ...rest } = parameters;\n let account;\n if (parameters.account)\n account = parameters.account;\n else {\n const connectorClient = await getConnectorClient(config, {\n chainId,\n connector,\n });\n account = connectorClient.account;\n }\n const client = config.getClient({ chainId });\n const action = getAction(client, viem_simulateContract, 'simulateContract');\n const { result, request } = await action({ ...rest, abi, account });\n return {\n chainId: client.chain.id,\n result,\n request: { __mode: 'prepared', ...request, chainId },\n };\n}\n//# sourceMappingURL=simulateContract.js.map","import { ConnectorNotConnectedError, } from '../errors/config.js';\n/** https://wagmi.sh/core/api/actions/switchAccount */\nexport async function switchAccount(config, parameters) {\n const { connector } = parameters;\n const connection = config.state.connections.get(connector.uid);\n if (!connection)\n throw new ConnectorNotConnectedError();\n await config.storage?.setItem('recentConnectorId', connector.id);\n config.setState((x) => ({\n ...x,\n current: connector.uid,\n }));\n return {\n accounts: connection.accounts,\n chainId: connection.chainId,\n };\n}\n//# sourceMappingURL=switchAccount.js.map","import { BaseError } from './base.js';\nexport class ProviderNotFoundError extends BaseError {\n constructor() {\n super('Provider not found.');\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'ProviderNotFoundError'\n });\n }\n}\nexport class SwitchChainNotSupportedError extends BaseError {\n constructor({ connector }) {\n super(`\"${connector.name}\" does not support programmatic chain switching.`);\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'SwitchChainNotSupportedError'\n });\n }\n}\n//# sourceMappingURL=connector.js.map","import { ChainNotConfiguredError, } from '../errors/config.js';\nimport { SwitchChainNotSupportedError, } from '../errors/connector.js';\n/** https://wagmi.sh/core/api/actions/switchChain */\nexport async function switchChain(config, parameters) {\n const { addEthereumChainParameter, chainId } = parameters;\n const connection = config.state.connections.get(parameters.connector?.uid ?? config.state.current);\n if (connection) {\n const connector = connection.connector;\n if (!connector.switchChain)\n throw new SwitchChainNotSupportedError({ connector });\n const chain = await connector.switchChain({\n addEthereumChainParameter,\n chainId,\n });\n return chain;\n }\n const chain = config.chains.find((x) => x.id === chainId);\n if (!chain)\n throw new ChainNotConfiguredError();\n config.setState((x) => ({ ...x, chainId }));\n return chain;\n}\n//# sourceMappingURL=switchChain.js.map","import { deepEqual } from '../utils/deepEqual.js';\nimport { getAccount } from './getAccount.js';\n/** https://wagmi.sh/core/api/actions/watchAccount */\nexport function watchAccount(config, parameters) {\n const { onChange } = parameters;\n return config.subscribe(() => getAccount(config), onChange, {\n equalityFn(a, b) {\n const { connector: aConnector, ...aRest } = a;\n const { connector: bConnector, ...bRest } = b;\n return (deepEqual(aRest, bRest) &&\n // check connector separately\n aConnector?.id === bConnector?.id &&\n aConnector?.uid === bConnector?.uid);\n },\n });\n}\n//# sourceMappingURL=watchAccount.js.map","/** https://wagmi.sh/core/api/actions/watchChainId */\nexport function watchChainId(config, parameters) {\n const { onChange } = parameters;\n return config.subscribe((state) => state.chainId, onChange);\n}\n//# sourceMappingURL=watchChainId.js.map","import { deepEqual } from '../utils/deepEqual.js';\nimport { getConnections, } from './getConnections.js';\n/** https://wagmi.sh/core/api/actions/watchConnections */\nexport function watchConnections(config, parameters) {\n const { onChange } = parameters;\n return config.subscribe(() => getConnections(config), onChange, {\n equalityFn: deepEqual,\n });\n}\n//# sourceMappingURL=watchConnections.js.map","/** https://wagmi.sh/core/api/actions/watchConnectors */\nexport function watchConnectors(config, parameters) {\n const { onChange } = parameters;\n return config._internal.connectors.subscribe((connectors, prevConnectors) => {\n onChange(Object.values(connectors), prevConnectors);\n });\n}\n//# sourceMappingURL=watchConnectors.js.map","import { hexToString } from 'viem';\nimport { call, getTransaction, waitForTransactionReceipt as viem_waitForTransactionReceipt, } from 'viem/actions';\nimport { getAction } from '../utils/getAction.js';\nexport async function waitForTransactionReceipt(config, parameters) {\n const { chainId, timeout = 0, ...rest } = parameters;\n const client = config.getClient({ chainId });\n const action = getAction(client, viem_waitForTransactionReceipt, 'waitForTransactionReceipt');\n const receipt = await action({ ...rest, timeout });\n if (receipt.status === 'reverted') {\n const action_getTransaction = getAction(client, getTransaction, 'getTransaction');\n const txn = await action_getTransaction({ hash: receipt.transactionHash });\n const action_call = getAction(client, call, 'call');\n const code = await action_call({\n ...txn,\n gasPrice: txn.type !== 'eip1559' ? txn.gasPrice : undefined,\n maxFeePerGas: txn.type === 'eip1559' ? txn.maxFeePerGas : undefined,\n maxPriorityFeePerGas: txn.type === 'eip1559' ? txn.maxPriorityFeePerGas : undefined,\n });\n const reason = code?.data\n ? hexToString(`0x${code.data.substring(138)}`)\n : 'unknown reason';\n throw new Error(reason);\n }\n return {\n ...receipt,\n chainId: client.chain.id,\n };\n}\n//# sourceMappingURL=waitForTransactionReceipt.js.map","import { writeContract as viem_writeContract, } from 'viem/actions';\nimport { getAction } from '../utils/getAction.js';\nimport { getAccount } from './getAccount.js';\nimport { getConnectorClient, } from './getConnectorClient.js';\nimport { simulateContract, } from './simulateContract.js';\n/** https://wagmi.sh/core/api/actions/writeContract */\nexport async function writeContract(config, parameters) {\n const { account, chainId, connector, __mode, ...rest } = parameters;\n let client;\n if (typeof account === 'object' && account?.type === 'local')\n client = config.getClient({ chainId });\n else\n client = await getConnectorClient(config, {\n account: account ?? undefined,\n chainId,\n connector,\n });\n const { connector: activeConnector } = getAccount(config);\n let request;\n if (__mode === 'prepared' || activeConnector?.supportsSimulation)\n request = rest;\n else {\n const { request: simulateRequest } = await simulateContract(config, {\n ...rest,\n account,\n chainId,\n });\n request = simulateRequest;\n }\n const action = getAction(client, viem_writeContract, 'writeContract');\n const hash = await action({\n ...request,\n ...(account ? { account } : {}),\n chain: chainId ? { id: chainId } : null,\n });\n return hash;\n}\n//# sourceMappingURL=writeContract.js.map","export function createConnector(createConnectorFn) {\n return createConnectorFn;\n}\n//# sourceMappingURL=createConnector.js.map","import { ResourceUnavailableRpcError, SwitchChainError, UserRejectedRequestError, getAddress, numberToHex, withRetry, withTimeout, } from 'viem';\nimport { ChainNotConfiguredError } from '../errors/config.js';\nimport { ProviderNotFoundError } from '../errors/connector.js';\nimport { createConnector } from './createConnector.js';\n// Regex of wallets/providers that can accurately simulate contract calls & display contract revert reasons.\nconst supportsSimulationIdRegex = /(rabby|trustwallet)/;\ninjected.type = 'injected';\nexport function injected(parameters = {}) {\n const { shimDisconnect = true, unstable_shimAsyncInject } = parameters;\n function getTarget() {\n const target = parameters.target;\n if (typeof target === 'function') {\n const result = target();\n if (result)\n return result;\n }\n if (typeof target === 'object')\n return target;\n if (typeof target === 'string')\n return {\n ...(targetMap[target] ?? {\n id: target,\n name: `${target[0].toUpperCase()}${target.slice(1)}`,\n provider: `is${target[0].toUpperCase()}${target.slice(1)}`,\n }),\n };\n return {\n id: 'injected',\n name: 'Injected',\n provider(window) {\n return window?.ethereum;\n },\n };\n }\n let accountsChanged;\n let chainChanged;\n let connect;\n let disconnect;\n return createConnector((config) => ({\n get icon() {\n return getTarget().icon;\n },\n get id() {\n return getTarget().id;\n },\n get name() {\n return getTarget().name;\n },\n get supportsSimulation() {\n return supportsSimulationIdRegex.test(this.id.toLowerCase());\n },\n type: injected.type,\n async setup() {\n const provider = await this.getProvider();\n // Only start listening for events if `target` is set, otherwise `injected()` will also receive events\n if (provider?.on && parameters.target) {\n if (!connect) {\n connect = this.onConnect.bind(this);\n provider.on('connect', connect);\n }\n // We shouldn't need to listen for `'accountsChanged'` here since the `'connect'` event should suffice (and wallet shouldn't be connected yet).\n // Some wallets, like MetaMask, do not implement the `'connect'` event and overload `'accountsChanged'` instead.\n if (!accountsChanged) {\n accountsChanged = this.onAccountsChanged.bind(this);\n provider.on('accountsChanged', accountsChanged);\n }\n }\n },\n async connect({ chainId, isReconnecting } = {}) {\n const provider = await this.getProvider();\n if (!provider)\n throw new ProviderNotFoundError();\n let accounts = [];\n if (isReconnecting)\n accounts = await this.getAccounts().catch(() => []);\n else if (shimDisconnect) {\n // Attempt to show another prompt for selecting account if `shimDisconnect` flag is enabled\n try {\n const permissions = await provider.request({\n method: 'wallet_requestPermissions',\n params: [{ eth_accounts: {} }],\n });\n accounts = permissions[0]?.caveats?.[0]?.value?.map((x) => getAddress(x));\n // `'wallet_requestPermissions'` can return a different order of accounts than `'eth_accounts'`\n // switch to `'eth_accounts'` ordering if more than one account is connected\n // https://github.com/wevm/wagmi/issues/4140\n if (accounts.length > 0) {\n const sortedAccounts = await this.getAccounts();\n accounts = sortedAccounts;\n }\n }\n catch (err) {\n const error = err;\n // Not all injected providers support `wallet_requestPermissions` (e.g. MetaMask iOS).\n // Only bubble up error if user rejects request\n if (error.code === UserRejectedRequestError.code)\n throw new UserRejectedRequestError(error);\n // Or prompt is already open\n if (error.code === ResourceUnavailableRpcError.code)\n throw error;\n }\n }\n try {\n if (!accounts?.length && !isReconnecting) {\n const requestedAccounts = await provider.request({\n method: 'eth_requestAccounts',\n });\n accounts = requestedAccounts.map((x) => getAddress(x));\n }\n // Manage EIP-1193 event listeners\n // https://eips.ethereum.org/EIPS/eip-1193#events\n if (connect) {\n provider.removeListener('connect', connect);\n connect = undefined;\n }\n if (!accountsChanged) {\n accountsChanged = this.onAccountsChanged.bind(this);\n provider.on('accountsChanged', accountsChanged);\n }\n if (!chainChanged) {\n chainChanged = this.onChainChanged.bind(this);\n provider.on('chainChanged', chainChanged);\n }\n if (!disconnect) {\n disconnect = this.onDisconnect.bind(this);\n provider.on('disconnect', disconnect);\n }\n // Switch to chain if provided\n let currentChainId = await this.getChainId();\n if (chainId && currentChainId !== chainId) {\n const chain = await this.switchChain({ chainId }).catch((error) => {\n if (error.code === UserRejectedRequestError.code)\n throw error;\n return { id: currentChainId };\n });\n currentChainId = chain?.id ?? currentChainId;\n }\n // Remove disconnected shim if it exists\n if (shimDisconnect)\n await config.storage?.removeItem(`${this.id}.disconnected`);\n // Add connected shim if no target exists\n if (!parameters.target)\n await config.storage?.setItem('injected.connected', true);\n return { accounts, chainId: currentChainId };\n }\n catch (err) {\n const error = err;\n if (error.code === UserRejectedRequestError.code)\n throw new UserRejectedRequestError(error);\n if (error.code === ResourceUnavailableRpcError.code)\n throw new ResourceUnavailableRpcError(error);\n throw error;\n }\n },\n async disconnect() {\n const provider = await this.getProvider();\n if (!provider)\n throw new ProviderNotFoundError();\n // Manage EIP-1193 event listeners\n if (chainChanged) {\n provider.removeListener('chainChanged', chainChanged);\n chainChanged = undefined;\n }\n if (disconnect) {\n provider.removeListener('disconnect', disconnect);\n disconnect = undefined;\n }\n if (!connect) {\n connect = this.onConnect.bind(this);\n provider.on('connect', connect);\n }\n // Experimental support for MetaMask disconnect\n // https://github.com/MetaMask/metamask-improvement-proposals/blob/main/MIPs/mip-2.md\n try {\n // Adding timeout as not all wallets support this method and can hang\n // https://github.com/wevm/wagmi/issues/4064\n await withTimeout(() => \n // TODO: Remove explicit type for viem@3\n provider.request({\n // `'wallet_revokePermissions'` added in `viem@2.10.3`\n method: 'wallet_revokePermissions',\n params: [{ eth_accounts: {} }],\n }), { timeout: 100 });\n }\n catch { }\n // Add shim signalling connector is disconnected\n if (shimDisconnect) {\n await config.storage?.setItem(`${this.id}.disconnected`, true);\n }\n if (!parameters.target)\n await config.storage?.removeItem('injected.connected');\n },\n async getAccounts() {\n const provider = await this.getProvider();\n if (!provider)\n throw new ProviderNotFoundError();\n const accounts = await provider.request({ method: 'eth_accounts' });\n return accounts.map((x) => getAddress(x));\n },\n async getChainId() {\n const provider = await this.getProvider();\n if (!provider)\n throw new ProviderNotFoundError();\n const hexChainId = await provider.request({ method: 'eth_chainId' });\n return Number(hexChainId);\n },\n async getProvider() {\n if (typeof window === 'undefined')\n return undefined;\n let provider;\n const target = getTarget();\n if (typeof target.provider === 'function')\n provider = target.provider(window);\n else if (typeof target.provider === 'string')\n provider = findProvider(window, target.provider);\n else\n provider = target.provider;\n // Some wallets do not conform to EIP-1193 (e.g. Trust Wallet)\n // https://github.com/wevm/wagmi/issues/3526#issuecomment-1912683002\n if (provider && !provider.removeListener) {\n // Try using `off` handler if it exists, otherwise noop\n if ('off' in provider && typeof provider.off === 'function')\n provider.removeListener =\n provider.off;\n else\n provider.removeListener = () => { };\n }\n return provider;\n },\n async isAuthorized() {\n try {\n const isDisconnected = shimDisconnect &&\n // If shim exists in storage, connector is disconnected\n (await config.storage?.getItem(`${this.id}.disconnected`));\n if (isDisconnected)\n return false;\n // Don't allow injected connector to connect if no target is set and it hasn't already connected\n // (e.g. flag in storage is not set). This prevents a targetless injected connector from connecting\n // automatically whenever there is a targeted connector configured.\n if (!parameters.target) {\n const connected = await config.storage?.getItem('injected.connected');\n if (!connected)\n return false;\n }\n const provider = await this.getProvider();\n if (!provider) {\n if (unstable_shimAsyncInject !== undefined &&\n unstable_shimAsyncInject !== false) {\n // If no provider is found, check for async injection\n // https://github.com/wevm/references/issues/167\n // https://github.com/MetaMask/detect-provider\n const handleEthereum = async () => {\n if (typeof window !== 'undefined')\n window.removeEventListener('ethereum#initialized', handleEthereum);\n const provider = await this.getProvider();\n return !!provider;\n };\n const timeout = typeof unstable_shimAsyncInject === 'number'\n ? unstable_shimAsyncInject\n : 1_000;\n const res = await Promise.race([\n ...(typeof window !== 'undefined'\n ? [\n new Promise((resolve) => window.addEventListener('ethereum#initialized', () => resolve(handleEthereum()), { once: true })),\n ]\n : []),\n new Promise((resolve) => setTimeout(() => resolve(handleEthereum()), timeout)),\n ]);\n if (res)\n return true;\n }\n throw new ProviderNotFoundError();\n }\n // Use retry strategy as some injected wallets (e.g. MetaMask) fail to\n // immediately resolve JSON-RPC requests on page load.\n const accounts = await withRetry(() => this.getAccounts());\n return !!accounts.length;\n }\n catch {\n return false;\n }\n },\n async switchChain({ addEthereumChainParameter, chainId }) {\n const provider = await this.getProvider();\n if (!provider)\n throw new ProviderNotFoundError();\n const chain = config.chains.find((x) => x.id === chainId);\n if (!chain)\n throw new SwitchChainError(new ChainNotConfiguredError());\n try {\n await Promise.all([\n provider\n .request({\n method: 'wallet_switchEthereumChain',\n params: [{ chainId: numberToHex(chainId) }],\n })\n // During `'wallet_switchEthereumChain'`, MetaMask makes a `'net_version'` RPC call to the target chain.\n // If this request fails, MetaMask does not emit the `'chainChanged'` event, but will still switch the chain.\n // To counter this behavior, we request and emit the current chain ID to confirm the chain switch either via\n // this callback or an externally emitted `'chainChanged'` event.\n // https://github.com/MetaMask/metamask-extension/issues/24247\n .then(async () => {\n const currentChainId = await this.getChainId();\n if (currentChainId === chainId)\n config.emitter.emit('change', { chainId });\n }),\n new Promise((resolve) => {\n const listener = ((data) => {\n if ('chainId' in data && data.chainId === chainId) {\n config.emitter.off('change', listener);\n resolve();\n }\n });\n config.emitter.on('change', listener);\n }),\n ]);\n return chain;\n }\n catch (err) {\n const error = err;\n // Indicates chain is not added to provider\n if (error.code === 4902 ||\n // Unwrapping for MetaMask Mobile\n // https://github.com/MetaMask/metamask-mobile/issues/2944#issuecomment-976988719\n error\n ?.data?.originalError?.code === 4902) {\n try {\n const { default: blockExplorer, ...blockExplorers } = chain.blockExplorers ?? {};\n let blockExplorerUrls;\n if (addEthereumChainParameter?.blockExplorerUrls)\n blockExplorerUrls = addEthereumChainParameter.blockExplorerUrls;\n else if (blockExplorer)\n blockExplorerUrls = [\n blockExplorer.url,\n ...Object.values(blockExplorers).map((x) => x.url),\n ];\n let rpcUrls;\n if (addEthereumChainParameter?.rpcUrls?.length)\n rpcUrls = addEthereumChainParameter.rpcUrls;\n else\n rpcUrls = [chain.rpcUrls.default?.http[0] ?? ''];\n const addEthereumChain = {\n blockExplorerUrls,\n chainId: numberToHex(chainId),\n chainName: addEthereumChainParameter?.chainName ?? chain.name,\n iconUrls: addEthereumChainParameter?.iconUrls,\n nativeCurrency: addEthereumChainParameter?.nativeCurrency ??\n chain.nativeCurrency,\n rpcUrls,\n };\n await provider.request({\n method: 'wallet_addEthereumChain',\n params: [addEthereumChain],\n });\n const currentChainId = await this.getChainId();\n if (currentChainId !== chainId)\n throw new UserRejectedRequestError(new Error('User rejected switch after adding network.'));\n return chain;\n }\n catch (error) {\n throw new UserRejectedRequestError(error);\n }\n }\n if (error.code === UserRejectedRequestError.code)\n throw new UserRejectedRequestError(error);\n throw new SwitchChainError(error);\n }\n },\n async onAccountsChanged(accounts) {\n // Disconnect if there are no accounts\n if (accounts.length === 0)\n this.onDisconnect();\n // Connect if emitter is listening for connect event (e.g. is disconnected and connects through wallet interface)\n else if (config.emitter.listenerCount('connect')) {\n const chainId = (await this.getChainId()).toString();\n this.onConnect({ chainId });\n // Remove disconnected shim if it exists\n if (shimDisconnect)\n await config.storage?.removeItem(`${this.id}.disconnected`);\n }\n // Regular change event\n else\n config.emitter.emit('change', {\n accounts: accounts.map((x) => getAddress(x)),\n });\n },\n onChainChanged(chain) {\n const chainId = Number(chain);\n config.emitter.emit('change', { chainId });\n },\n async onConnect(connectInfo) {\n const accounts = await this.getAccounts();\n if (accounts.length === 0)\n return;\n const chainId = Number(connectInfo.chainId);\n config.emitter.emit('connect', { accounts, chainId });\n // Manage EIP-1193 event listeners\n const provider = await this.getProvider();\n if (provider) {\n if (connect) {\n provider.removeListener('connect', connect);\n connect = undefined;\n }\n if (!accountsChanged) {\n accountsChanged = this.onAccountsChanged.bind(this);\n provider.on('accountsChanged', accountsChanged);\n }\n if (!chainChanged) {\n chainChanged = this.onChainChanged.bind(this);\n provider.on('chainChanged', chainChanged);\n }\n if (!disconnect) {\n disconnect = this.onDisconnect.bind(this);\n provider.on('disconnect', disconnect);\n }\n }\n },\n async onDisconnect(error) {\n const provider = await this.getProvider();\n // If MetaMask emits a `code: 1013` error, wait for reconnection before disconnecting\n // https://github.com/MetaMask/providers/pull/120\n if (error && error.code === 1013) {\n if (provider && !!(await this.getAccounts()).length)\n return;\n }\n // No need to remove `${this.id}.disconnected` from storage because `onDisconnect` is typically\n // only called when the wallet is disconnected through the wallet's interface, meaning the wallet\n // actually disconnected and we don't need to simulate it.\n config.emitter.emit('disconnect');\n // Manage EIP-1193 event listeners\n if (provider) {\n if (chainChanged) {\n provider.removeListener('chainChanged', chainChanged);\n chainChanged = undefined;\n }\n if (disconnect) {\n provider.removeListener('disconnect', disconnect);\n disconnect = undefined;\n }\n if (!connect) {\n connect = this.onConnect.bind(this);\n provider.on('connect', connect);\n }\n }\n },\n }));\n}\nconst targetMap = {\n coinbaseWallet: {\n id: 'coinbaseWallet',\n name: 'Coinbase Wallet',\n provider(window) {\n if (window?.coinbaseWalletExtension)\n return window.coinbaseWalletExtension;\n return findProvider(window, 'isCoinbaseWallet');\n },\n },\n metaMask: {\n id: 'metaMask',\n name: 'MetaMask',\n provider(window) {\n return findProvider(window, (provider) => {\n if (!provider.isMetaMask)\n return false;\n // Brave tries to make itself look like MetaMask\n // Could also try RPC `web3_clientVersion` if following is unreliable\n if (provider.isBraveWallet && !provider._events && !provider._state)\n return false;\n // Other wallets that try to look like MetaMask\n const flags = [\n 'isApexWallet',\n 'isAvalanche',\n 'isBitKeep',\n 'isBlockWallet',\n 'isKuCoinWallet',\n 'isMathWallet',\n 'isOkxWallet',\n 'isOKExWallet',\n 'isOneInchIOSWallet',\n 'isOneInchAndroidWallet',\n 'isOpera',\n 'isPortal',\n 'isRabby',\n 'isTokenPocket',\n 'isTokenary',\n 'isUniswapWallet',\n 'isZerion',\n ];\n for (const flag of flags)\n if (provider[flag])\n return false;\n return true;\n });\n },\n },\n phantom: {\n id: 'phantom',\n name: 'Phantom',\n provider(window) {\n if (window?.phantom?.ethereum)\n return window.phantom?.ethereum;\n return findProvider(window, 'isPhantom');\n },\n },\n};\nfunction findProvider(window, select) {\n function isProvider(provider) {\n if (typeof select === 'function')\n return select(provider);\n if (typeof select === 'string')\n return provider[select];\n return true;\n }\n const ethereum = window.ethereum;\n if (ethereum?.providers)\n return ethereum.providers.find((provider) => isProvider(provider));\n if (ethereum && isProvider(ethereum))\n return ethereum;\n return undefined;\n}\n//# sourceMappingURL=injected.js.map","/**\n * Announces an EIP-1193 Provider.\n */\nexport function announceProvider(detail) {\n const event = new CustomEvent('eip6963:announceProvider', { detail: Object.freeze(detail) });\n window.dispatchEvent(event);\n const handler = () => window.dispatchEvent(event);\n window.addEventListener('eip6963:requestProvider', handler);\n return () => window.removeEventListener('eip6963:requestProvider', handler);\n}\n/**\n * Watches for EIP-1193 Providers to be announced.\n */\nexport function requestProviders(listener) {\n if (typeof window === 'undefined')\n return;\n const handler = (event) => listener(event.detail);\n window.addEventListener('eip6963:announceProvider', handler);\n window.dispatchEvent(new CustomEvent('eip6963:requestProvider'));\n return () => window.removeEventListener('eip6963:announceProvider', handler);\n}\n//# sourceMappingURL=utils.js.map","import { requestProviders } from './utils.js';\nexport function createStore() {\n const listeners = new Set();\n let providerDetails = [];\n const request = () => requestProviders((providerDetail) => {\n if (providerDetails.some(({ info }) => info.uuid === providerDetail.info.uuid))\n return;\n providerDetails = [...providerDetails, providerDetail];\n listeners.forEach((listener) => listener(providerDetails, { added: [providerDetail] }));\n });\n let unwatch = request();\n return {\n _listeners() {\n return listeners;\n },\n clear() {\n listeners.forEach((listener) => listener([], { removed: [...providerDetails] }));\n providerDetails = [];\n },\n destroy() {\n this.clear();\n listeners.clear();\n unwatch?.();\n },\n findProvider({ rdns }) {\n return providerDetails.find((providerDetail) => providerDetail.info.rdns === rdns);\n },\n getProviders() {\n return providerDetails;\n },\n reset() {\n this.clear();\n unwatch?.();\n unwatch = request();\n },\n subscribe(listener, { emitImmediately } = {}) {\n listeners.add(listener);\n if (emitImmediately)\n listener(providerDetails, { added: providerDetails });\n return () => listeners.delete(listener);\n },\n };\n}\n//# sourceMappingURL=store.js.map","const reduxImpl = (reducer, initial) => (set, _get, api) => {\n api.dispatch = (action) => {\n set((state) => reducer(state, action), false, action);\n return action;\n };\n api.dispatchFromDevtools = true;\n return { dispatch: (...a) => api.dispatch(...a), ...initial };\n};\nconst redux = reduxImpl;\n\nconst trackedConnections = /* @__PURE__ */ new Map();\nconst getTrackedConnectionState = (name) => {\n const api = trackedConnections.get(name);\n if (!api) return {};\n return Object.fromEntries(\n Object.entries(api.stores).map(([key, api2]) => [key, api2.getState()])\n );\n};\nconst extractConnectionInformation = (store, extensionConnector, options) => {\n if (store === void 0) {\n return {\n type: \"untracked\",\n connection: extensionConnector.connect(options)\n };\n }\n const existingConnection = trackedConnections.get(options.name);\n if (existingConnection) {\n return { type: \"tracked\", store, ...existingConnection };\n }\n const newConnection = {\n connection: extensionConnector.connect(options),\n stores: {}\n };\n trackedConnections.set(options.name, newConnection);\n return { type: \"tracked\", store, ...newConnection };\n};\nconst devtoolsImpl = (fn, devtoolsOptions = {}) => (set, get, api) => {\n const { enabled, anonymousActionType, store, ...options } = devtoolsOptions;\n let extensionConnector;\n try {\n extensionConnector = (enabled != null ? enabled : (import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") && window.__REDUX_DEVTOOLS_EXTENSION__;\n } catch (e) {\n }\n if (!extensionConnector) {\n return fn(set, get, api);\n }\n const { connection, ...connectionInformation } = extractConnectionInformation(store, extensionConnector, options);\n let isRecording = true;\n api.setState = (state, replace, nameOrAction) => {\n const r = set(state, replace);\n if (!isRecording) return r;\n const action = nameOrAction === void 0 ? { type: anonymousActionType || \"anonymous\" } : typeof nameOrAction === \"string\" ? { type: nameOrAction } : nameOrAction;\n if (store === void 0) {\n connection == null ? void 0 : connection.send(action, get());\n return r;\n }\n connection == null ? void 0 : connection.send(\n {\n ...action,\n type: `${store}/${action.type}`\n },\n {\n ...getTrackedConnectionState(options.name),\n [store]: api.getState()\n }\n );\n return r;\n };\n const setStateFromDevtools = (...a) => {\n const originalIsRecording = isRecording;\n isRecording = false;\n set(...a);\n isRecording = originalIsRecording;\n };\n const initialState = fn(api.setState, get, api);\n if (connectionInformation.type === \"untracked\") {\n connection == null ? void 0 : connection.init(initialState);\n } else {\n connectionInformation.stores[connectionInformation.store] = api;\n connection == null ? void 0 : connection.init(\n Object.fromEntries(\n Object.entries(connectionInformation.stores).map(([key, store2]) => [\n key,\n key === connectionInformation.store ? initialState : store2.getState()\n ])\n )\n );\n }\n if (api.dispatchFromDevtools && typeof api.dispatch === \"function\") {\n let didWarnAboutReservedActionType = false;\n const originalDispatch = api.dispatch;\n api.dispatch = (...a) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\" && a[0].type === \"__setState\" && !didWarnAboutReservedActionType) {\n console.warn(\n '[zustand devtools middleware] \"__setState\" action type is reserved to set state from the devtools. Avoid using it.'\n );\n didWarnAboutReservedActionType = true;\n }\n originalDispatch(...a);\n };\n }\n connection.subscribe((message) => {\n var _a;\n switch (message.type) {\n case \"ACTION\":\n if (typeof message.payload !== \"string\") {\n console.error(\n \"[zustand devtools middleware] Unsupported action format\"\n );\n return;\n }\n return parseJsonThen(\n message.payload,\n (action) => {\n if (action.type === \"__setState\") {\n if (store === void 0) {\n setStateFromDevtools(action.state);\n return;\n }\n if (Object.keys(action.state).length !== 1) {\n console.error(\n `\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n `\n );\n }\n const stateFromDevtools = action.state[store];\n if (stateFromDevtools === void 0 || stateFromDevtools === null) {\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(stateFromDevtools)) {\n setStateFromDevtools(stateFromDevtools);\n }\n return;\n }\n if (!api.dispatchFromDevtools) return;\n if (typeof api.dispatch !== \"function\") return;\n api.dispatch(action);\n }\n );\n case \"DISPATCH\":\n switch (message.payload.type) {\n case \"RESET\":\n setStateFromDevtools(initialState);\n if (store === void 0) {\n return connection == null ? void 0 : connection.init(api.getState());\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"COMMIT\":\n if (store === void 0) {\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"ROLLBACK\":\n return parseJsonThen(message.state, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n setStateFromDevtools(state[store]);\n connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n });\n case \"JUMP_TO_STATE\":\n case \"JUMP_TO_ACTION\":\n return parseJsonThen(message.state, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(state[store])) {\n setStateFromDevtools(state[store]);\n }\n });\n case \"IMPORT_STATE\": {\n const { nextLiftedState } = message.payload;\n const lastComputedState = (_a = nextLiftedState.computedStates.slice(-1)[0]) == null ? void 0 : _a.state;\n if (!lastComputedState) return;\n if (store === void 0) {\n setStateFromDevtools(lastComputedState);\n } else {\n setStateFromDevtools(lastComputedState[store]);\n }\n connection == null ? void 0 : connection.send(\n null,\n // FIXME no-any\n nextLiftedState\n );\n return;\n }\n case \"PAUSE_RECORDING\":\n return isRecording = !isRecording;\n }\n return;\n }\n });\n return initialState;\n};\nconst devtools = devtoolsImpl;\nconst parseJsonThen = (stringified, f) => {\n let parsed;\n try {\n parsed = JSON.parse(stringified);\n } catch (e) {\n console.error(\n \"[zustand devtools middleware] Could not parse the received json\",\n e\n );\n }\n if (parsed !== void 0) f(parsed);\n};\n\nconst subscribeWithSelectorImpl = (fn) => (set, get, api) => {\n const origSubscribe = api.subscribe;\n api.subscribe = (selector, optListener, options) => {\n let listener = selector;\n if (optListener) {\n const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;\n let currentSlice = selector(api.getState());\n listener = (state) => {\n const nextSlice = selector(state);\n if (!equalityFn(currentSlice, nextSlice)) {\n const previousSlice = currentSlice;\n optListener(currentSlice = nextSlice, previousSlice);\n }\n };\n if (options == null ? void 0 : options.fireImmediately) {\n optListener(currentSlice, currentSlice);\n }\n }\n return origSubscribe(listener);\n };\n const initialState = fn(set, get, api);\n return initialState;\n};\nconst subscribeWithSelector = subscribeWithSelectorImpl;\n\nconst combine = (initialState, create) => (...a) => Object.assign({}, initialState, create(...a));\n\nfunction createJSONStorage(getStorage, options) {\n let storage;\n try {\n storage = getStorage();\n } catch (e) {\n return;\n }\n const persistStorage = {\n getItem: (name) => {\n var _a;\n const parse = (str2) => {\n if (str2 === null) {\n return null;\n }\n return JSON.parse(str2, options == null ? void 0 : options.reviver);\n };\n const str = (_a = storage.getItem(name)) != null ? _a : null;\n if (str instanceof Promise) {\n return str.then(parse);\n }\n return parse(str);\n },\n setItem: (name, newValue) => storage.setItem(\n name,\n JSON.stringify(newValue, options == null ? void 0 : options.replacer)\n ),\n removeItem: (name) => storage.removeItem(name)\n };\n return persistStorage;\n}\nconst toThenable = (fn) => (input) => {\n try {\n const result = fn(input);\n if (result instanceof Promise) {\n return result;\n }\n return {\n then(onFulfilled) {\n return toThenable(onFulfilled)(result);\n },\n catch(_onRejected) {\n return this;\n }\n };\n } catch (e) {\n return {\n then(_onFulfilled) {\n return this;\n },\n catch(onRejected) {\n return toThenable(onRejected)(e);\n }\n };\n }\n};\nconst persistImpl = (config, baseOptions) => (set, get, api) => {\n let options = {\n storage: createJSONStorage(() => localStorage),\n partialize: (state) => state,\n version: 0,\n merge: (persistedState, currentState) => ({\n ...currentState,\n ...persistedState\n }),\n ...baseOptions\n };\n let hasHydrated = false;\n const hydrationListeners = /* @__PURE__ */ new Set();\n const finishHydrationListeners = /* @__PURE__ */ new Set();\n let storage = options.storage;\n if (!storage) {\n return config(\n (...args) => {\n console.warn(\n `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`\n );\n set(...args);\n },\n get,\n api\n );\n }\n const setItem = () => {\n const state = options.partialize({ ...get() });\n return storage.setItem(options.name, {\n state,\n version: options.version\n });\n };\n const savedSetState = api.setState;\n api.setState = (state, replace) => {\n savedSetState(state, replace);\n void setItem();\n };\n const configResult = config(\n (...args) => {\n set(...args);\n void setItem();\n },\n get,\n api\n );\n api.getInitialState = () => configResult;\n let stateFromStorage;\n const hydrate = () => {\n var _a, _b;\n if (!storage) return;\n hasHydrated = false;\n hydrationListeners.forEach((cb) => {\n var _a2;\n return cb((_a2 = get()) != null ? _a2 : configResult);\n });\n const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;\n return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {\n if (deserializedStorageValue) {\n if (typeof deserializedStorageValue.version === \"number\" && deserializedStorageValue.version !== options.version) {\n if (options.migrate) {\n return [\n true,\n options.migrate(\n deserializedStorageValue.state,\n deserializedStorageValue.version\n )\n ];\n }\n console.error(\n `State loaded from storage couldn't be migrated since no migrate function was provided`\n );\n } else {\n return [false, deserializedStorageValue.state];\n }\n }\n return [false, void 0];\n }).then((migrationResult) => {\n var _a2;\n const [migrated, migratedState] = migrationResult;\n stateFromStorage = options.merge(\n migratedState,\n (_a2 = get()) != null ? _a2 : configResult\n );\n set(stateFromStorage, true);\n if (migrated) {\n return setItem();\n }\n }).then(() => {\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);\n stateFromStorage = get();\n hasHydrated = true;\n finishHydrationListeners.forEach((cb) => cb(stateFromStorage));\n }).catch((e) => {\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);\n });\n };\n api.persist = {\n setOptions: (newOptions) => {\n options = {\n ...options,\n ...newOptions\n };\n if (newOptions.storage) {\n storage = newOptions.storage;\n }\n },\n clearStorage: () => {\n storage == null ? void 0 : storage.removeItem(options.name);\n },\n getOptions: () => options,\n rehydrate: () => hydrate(),\n hasHydrated: () => hasHydrated,\n onHydrate: (cb) => {\n hydrationListeners.add(cb);\n return () => {\n hydrationListeners.delete(cb);\n };\n },\n onFinishHydration: (cb) => {\n finishHydrationListeners.add(cb);\n return () => {\n finishHydrationListeners.delete(cb);\n };\n }\n };\n if (!options.skipHydration) {\n hydrate();\n }\n return stateFromStorage || configResult;\n};\nconst persist = persistImpl;\n\nexport { combine, createJSONStorage, devtools, persist, redux, subscribeWithSelector };\n","const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const api = { setState, getState, getInitialState, subscribe };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;\n\nexport { createStore };\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","import { EventEmitter } from 'eventemitter3';\nexport class Emitter {\n constructor(uid) {\n Object.defineProperty(this, \"uid\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: uid\n });\n Object.defineProperty(this, \"_emitter\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new EventEmitter()\n });\n }\n on(eventName, fn) {\n this._emitter.on(eventName, fn);\n }\n once(eventName, fn) {\n this._emitter.once(eventName, fn);\n }\n off(eventName, fn) {\n this._emitter.off(eventName, fn);\n }\n emit(eventName, ...params) {\n const data = params[0];\n this._emitter.emit(eventName, { uid: this.uid, ...data });\n }\n listenerCount(eventName) {\n return this._emitter.listenerCount(eventName);\n }\n}\nexport function createEmitter(uid) {\n return new Emitter(uid);\n}\n//# sourceMappingURL=createEmitter.js.map","export function deserialize(value, reviver) {\n return JSON.parse(value, (key, value_) => {\n let value = value_;\n if (value?.__type === 'bigint')\n value = BigInt(value.value);\n if (value?.__type === 'Map')\n value = new Map(value.value);\n return reviver?.(key, value) ?? value;\n });\n}\n//# sourceMappingURL=deserialize.js.map","/**\n * Get the reference key for the circular value\n *\n * @param keys the keys to build the reference key from\n * @param cutoff the maximum number of keys to include\n * @returns the reference key\n */\nfunction getReferenceKey(keys, cutoff) {\n return keys.slice(0, cutoff).join('.') || '.';\n}\n/**\n * Faster `Array.prototype.indexOf` implementation build for slicing / splicing\n *\n * @param array the array to match the value in\n * @param value the value to match\n * @returns the matching index, or -1\n */\nfunction getCutoff(array, value) {\n const { length } = array;\n for (let index = 0; index < length; ++index) {\n if (array[index] === value) {\n return index + 1;\n }\n }\n return 0;\n}\n/**\n * Create a replacer method that handles circular values\n *\n * @param [replacer] a custom replacer to use for non-circular values\n * @param [circularReplacer] a custom replacer to use for circular methods\n * @returns the value to stringify\n */\nfunction createReplacer(replacer, circularReplacer) {\n const hasReplacer = typeof replacer === 'function';\n const hasCircularReplacer = typeof circularReplacer === 'function';\n const cache = [];\n const keys = [];\n return function replace(key, value) {\n if (typeof value === 'object') {\n if (cache.length) {\n const thisCutoff = getCutoff(cache, this);\n if (thisCutoff === 0) {\n cache[cache.length] = this;\n }\n else {\n cache.splice(thisCutoff);\n keys.splice(thisCutoff);\n }\n keys[keys.length] = key;\n const valueCutoff = getCutoff(cache, value);\n if (valueCutoff !== 0) {\n return hasCircularReplacer\n ? circularReplacer.call(this, key, value, getReferenceKey(keys, valueCutoff))\n : `[ref=${getReferenceKey(keys, valueCutoff)}]`;\n }\n }\n else {\n cache[0] = value;\n keys[0] = key;\n }\n }\n return hasReplacer ? replacer.call(this, key, value) : value;\n };\n}\n/**\n * Stringifier that handles circular values\n *\n * Forked from https://github.com/planttheidea/fast-stringify\n *\n * @param value to stringify\n * @param [replacer] a custom replacer function for handling standard values\n * @param [indent] the number of spaces to indent the output by\n * @param [circularReplacer] a custom replacer function for handling circular values\n * @returns the stringified output\n */\nexport function serialize(value, replacer, indent, circularReplacer) {\n return JSON.stringify(value, createReplacer((key, value_) => {\n let value = value_;\n if (typeof value === 'bigint')\n value = { __type: 'bigint', value: value_.toString() };\n if (value instanceof Map)\n value = { __type: 'Map', value: Array.from(value_.entries()) };\n return replacer?.(key, value) ?? value;\n }, circularReplacer), indent ?? undefined);\n}\n//# sourceMappingURL=serialize.js.map","import { deserialize as deserialize_ } from './utils/deserialize.js';\nimport { serialize as serialize_ } from './utils/serialize.js';\nexport function createStorage(parameters) {\n const { deserialize = deserialize_, key: prefix = 'wagmi', serialize = serialize_, storage = noopStorage, } = parameters;\n function unwrap(value) {\n if (value instanceof Promise)\n return value.then((x) => x).catch(() => null);\n return value;\n }\n return {\n ...storage,\n key: prefix,\n async getItem(key, defaultValue) {\n const value = storage.getItem(`${prefix}.${key}`);\n const unwrapped = await unwrap(value);\n if (unwrapped)\n return deserialize(unwrapped) ?? null;\n return (defaultValue ?? null);\n },\n async setItem(key, value) {\n const storageKey = `${prefix}.${key}`;\n if (value === null)\n await unwrap(storage.removeItem(storageKey));\n else\n await unwrap(storage.setItem(storageKey, serialize(value)));\n },\n async removeItem(key) {\n await unwrap(storage.removeItem(`${prefix}.${key}`));\n },\n };\n}\nexport const noopStorage = {\n getItem: () => null,\n setItem: () => { },\n removeItem: () => { },\n};\n//# sourceMappingURL=createStorage.js.map","const size = 256;\nlet index = size;\nlet buffer;\nexport function uid(length = 11) {\n if (!buffer || index + length > size * 2) {\n buffer = '';\n index = 0;\n for (let i = 0; i < size; i++) {\n buffer += ((256 + Math.random() * 256) | 0).toString(16).substring(1);\n }\n }\n return buffer.substring(index, index++ + length);\n}\n//# sourceMappingURL=uid.js.map","import { createStore as createMipd, } from 'mipd';\nimport { createClient, } from 'viem';\nimport { persist, subscribeWithSelector } from 'zustand/middleware';\nimport { createStore } from 'zustand/vanilla';\nimport { injected } from './connectors/injected.js';\nimport { createEmitter } from './createEmitter.js';\nimport { createStorage, noopStorage } from './createStorage.js';\nimport { ChainNotConfiguredError } from './errors/config.js';\nimport { uid } from './utils/uid.js';\nimport { version } from './version.js';\nexport function createConfig(parameters) {\n const { multiInjectedProviderDiscovery = true, storage = createStorage({\n storage: typeof window !== 'undefined' && window.localStorage\n ? window.localStorage\n : noopStorage,\n }), syncConnectedChain = true, ssr = false, ...rest } = parameters;\n /////////////////////////////////////////////////////////////////////////////////////////////////\n // Set up connectors, clients, etc.\n /////////////////////////////////////////////////////////////////////////////////////////////////\n const mipd = typeof window !== 'undefined' && multiInjectedProviderDiscovery\n ? createMipd()\n : undefined;\n const chains = createStore(() => rest.chains);\n const connectors = createStore(() => {\n const collection = [];\n const rdnsSet = new Set();\n for (const connectorFns of rest.connectors ?? []) {\n const connector = setup(connectorFns);\n collection.push(connector);\n if (!ssr && connector.rdns)\n rdnsSet.add(connector.rdns);\n }\n if (!ssr && mipd) {\n const providers = mipd.getProviders();\n for (const provider of providers) {\n if (rdnsSet.has(provider.info.rdns))\n continue;\n collection.push(setup(providerDetailToConnector(provider)));\n }\n }\n return collection;\n });\n function setup(connectorFn) {\n // Set up emitter with uid and add to connector so they are \"linked\" together.\n const emitter = createEmitter(uid());\n const connector = {\n ...connectorFn({\n emitter,\n chains: chains.getState(),\n storage,\n transports: rest.transports,\n }),\n emitter,\n uid: emitter.uid,\n };\n // Start listening for `connect` events on connector setup\n // This allows connectors to \"connect\" themselves without user interaction (e.g. MetaMask's \"Manually connect to current site\")\n emitter.on('connect', connect);\n connector.setup?.();\n return connector;\n }\n function providerDetailToConnector(providerDetail) {\n const { info } = providerDetail;\n const provider = providerDetail.provider;\n return injected({ target: { ...info, id: info.rdns, provider } });\n }\n const clients = new Map();\n function getClient(config = {}) {\n const chainId = config.chainId ?? store.getState().chainId;\n const chain = chains.getState().find((x) => x.id === chainId);\n // chainId specified and not configured\n if (config.chainId && !chain)\n throw new ChainNotConfiguredError();\n {\n const client = clients.get(store.getState().chainId);\n if (client && !chain)\n return client;\n if (!chain)\n throw new ChainNotConfiguredError();\n }\n // If a memoized client exists for a chain id, use that.\n {\n const client = clients.get(chainId);\n if (client)\n return client;\n }\n let client;\n if (rest.client)\n client = rest.client({ chain });\n else {\n const chainId = chain.id;\n const chainIds = chains.getState().map((x) => x.id);\n // Grab all properties off `rest` and resolve for use in `createClient`\n const properties = {};\n const entries = Object.entries(rest);\n for (const [key, value] of entries) {\n if (key === 'chains' ||\n key === 'client' ||\n key === 'connectors' ||\n key === 'transports')\n continue;\n if (typeof value === 'object') {\n // check if value is chainId-specific since some values can be objects\n // e.g. { batch: { multicall: { batchSize: 1024 } } }\n if (chainId in value)\n properties[key] = value[chainId];\n else {\n // check if value is chainId-specific, but does not have value for current chainId\n const hasChainSpecificValue = chainIds.some((x) => x in value);\n if (hasChainSpecificValue)\n continue;\n properties[key] = value;\n }\n }\n else\n properties[key] = value;\n }\n client = createClient({\n ...properties,\n chain,\n batch: properties.batch ?? { multicall: true },\n transport: (parameters) => rest.transports[chainId]({ ...parameters, connectors }),\n });\n }\n clients.set(chainId, client);\n return client;\n }\n /////////////////////////////////////////////////////////////////////////////////////////////////\n // Create store\n /////////////////////////////////////////////////////////////////////////////////////////////////\n function getInitialState() {\n return {\n chainId: chains.getState()[0].id,\n connections: new Map(),\n current: null,\n status: 'disconnected',\n };\n }\n let currentVersion;\n const prefix = '0.0.0-canary-';\n if (version.startsWith(prefix))\n currentVersion = Number.parseInt(version.replace(prefix, ''));\n // use package major version to version store\n else\n currentVersion = Number.parseInt(version.split('.')[0] ?? '0');\n const store = createStore(subscribeWithSelector(\n // only use persist middleware if storage exists\n storage\n ? persist(getInitialState, {\n migrate(persistedState, version) {\n if (version === currentVersion)\n return persistedState;\n const initialState = getInitialState();\n const chainId = validatePersistedChainId(persistedState, initialState.chainId);\n return { ...initialState, chainId };\n },\n name: 'store',\n partialize(state) {\n // Only persist \"critical\" store properties to preserve storage size.\n return {\n connections: {\n __type: 'Map',\n value: Array.from(state.connections.entries()).map(([key, connection]) => {\n const { id, name, type, uid } = connection.connector;\n const connector = { id, name, type, uid };\n return [key, { ...connection, connector }];\n }),\n },\n chainId: state.chainId,\n current: state.current,\n };\n },\n merge(persistedState, currentState) {\n // `status` should not be persisted as it messes with reconnection\n if (typeof persistedState === 'object' &&\n persistedState &&\n 'status' in persistedState)\n delete persistedState.status;\n // Make sure persisted `chainId` is valid\n const chainId = validatePersistedChainId(persistedState, currentState.chainId);\n return {\n ...currentState,\n ...persistedState,\n chainId,\n };\n },\n skipHydration: ssr,\n storage: storage,\n version: currentVersion,\n })\n : getInitialState));\n store.setState(getInitialState());\n function validatePersistedChainId(persistedState, defaultChainId) {\n return persistedState &&\n typeof persistedState === 'object' &&\n 'chainId' in persistedState &&\n typeof persistedState.chainId === 'number' &&\n chains.getState().some((x) => x.id === persistedState.chainId)\n ? persistedState.chainId\n : defaultChainId;\n }\n /////////////////////////////////////////////////////////////////////////////////////////////////\n // Subscribe to changes\n /////////////////////////////////////////////////////////////////////////////////////////////////\n // Update default chain when connector chain changes\n if (syncConnectedChain)\n store.subscribe(({ connections, current }) => current ? connections.get(current)?.chainId : undefined, (chainId) => {\n // If chain is not configured, then don't switch over to it.\n const isChainConfigured = chains\n .getState()\n .some((x) => x.id === chainId);\n if (!isChainConfigured)\n return;\n return store.setState((x) => ({\n ...x,\n chainId: chainId ?? x.chainId,\n }));\n });\n // EIP-6963 subscribe for new wallet providers\n mipd?.subscribe((providerDetails) => {\n const connectorIdSet = new Set();\n const connectorRdnsSet = new Set();\n for (const connector of connectors.getState()) {\n connectorIdSet.add(connector.id);\n if (connector.rdns)\n connectorRdnsSet.add(connector.rdns);\n }\n const newConnectors = [];\n for (const providerDetail of providerDetails) {\n if (connectorRdnsSet.has(providerDetail.info.rdns))\n continue;\n const connector = setup(providerDetailToConnector(providerDetail));\n if (connectorIdSet.has(connector.id))\n continue;\n newConnectors.push(connector);\n }\n if (storage && !store.persist.hasHydrated())\n return;\n connectors.setState((x) => [...x, ...newConnectors], true);\n });\n /////////////////////////////////////////////////////////////////////////////////////////////////\n // Emitter listeners\n /////////////////////////////////////////////////////////////////////////////////////////////////\n function change(data) {\n store.setState((x) => {\n const connection = x.connections.get(data.uid);\n if (!connection)\n return x;\n return {\n ...x,\n connections: new Map(x.connections).set(data.uid, {\n accounts: data.accounts ??\n connection.accounts,\n chainId: data.chainId ?? connection.chainId,\n connector: connection.connector,\n }),\n };\n });\n }\n function connect(data) {\n // Disable handling if reconnecting/connecting\n if (store.getState().status === 'connecting' ||\n store.getState().status === 'reconnecting')\n return;\n store.setState((x) => {\n const connector = connectors.getState().find((x) => x.uid === data.uid);\n if (!connector)\n return x;\n if (connector.emitter.listenerCount('connect'))\n connector.emitter.off('connect', change);\n if (!connector.emitter.listenerCount('change'))\n connector.emitter.on('change', change);\n if (!connector.emitter.listenerCount('disconnect'))\n connector.emitter.on('disconnect', disconnect);\n return {\n ...x,\n connections: new Map(x.connections).set(data.uid, {\n accounts: data.accounts,\n chainId: data.chainId,\n connector: connector,\n }),\n current: data.uid,\n status: 'connected',\n };\n });\n }\n function disconnect(data) {\n store.setState((x) => {\n const connection = x.connections.get(data.uid);\n if (connection) {\n const connector = connection.connector;\n if (connector.emitter.listenerCount('change'))\n connection.connector.emitter.off('change', change);\n if (connector.emitter.listenerCount('disconnect'))\n connection.connector.emitter.off('disconnect', disconnect);\n if (!connector.emitter.listenerCount('connect'))\n connection.connector.emitter.on('connect', connect);\n }\n x.connections.delete(data.uid);\n if (x.connections.size === 0)\n return {\n ...x,\n connections: new Map(),\n current: null,\n status: 'disconnected',\n };\n const nextConnection = x.connections.values().next().value;\n return {\n ...x,\n connections: new Map(x.connections),\n current: nextConnection.connector.uid,\n };\n });\n }\n return {\n get chains() {\n return chains.getState();\n },\n get connectors() {\n return connectors.getState();\n },\n storage,\n getClient,\n get state() {\n return store.getState();\n },\n setState(value) {\n let newState;\n if (typeof value === 'function')\n newState = value(store.getState());\n else\n newState = value;\n // Reset state if it got set to something not matching the base state\n const initialState = getInitialState();\n if (typeof newState !== 'object')\n newState = initialState;\n const isCorrupt = Object.keys(initialState).some((x) => !(x in newState));\n if (isCorrupt)\n newState = initialState;\n store.setState(newState, true);\n },\n subscribe(selector, listener, options) {\n return store.subscribe(selector, listener, options\n ? {\n ...options,\n fireImmediately: options.emitImmediately,\n // Workaround cast since Zustand does not support `'exactOptionalPropertyTypes'`\n }\n : undefined);\n },\n _internal: {\n mipd,\n store,\n ssr: Boolean(ssr),\n syncConnectedChain,\n transports: rest.transports,\n chains: {\n setState(value) {\n const nextChains = (typeof value === 'function' ? value(chains.getState()) : value);\n if (nextChains.length === 0)\n return;\n return chains.setState(nextChains, true);\n },\n subscribe(listener) {\n return chains.subscribe(listener);\n },\n },\n connectors: {\n providerDetailToConnector,\n setup,\n setState(value) {\n return connectors.setState(typeof value === 'function' ? value(connectors.getState()) : value, true);\n },\n subscribe(listener) {\n return connectors.subscribe(listener);\n },\n },\n events: { change, connect, disconnect },\n },\n };\n}\n//# sourceMappingURL=createConfig.js.map","import { reconnect } from './actions/reconnect.js';\nexport function hydrate(config, parameters) {\n const { initialState, reconnectOnMount } = parameters;\n if (initialState && !config._internal.store.persist.hasHydrated())\n config.setState({\n ...initialState,\n chainId: config.chains.some((x) => x.id === initialState.chainId)\n ? initialState.chainId\n : config.chains[0].id,\n connections: reconnectOnMount ? initialState.connections : new Map(),\n status: reconnectOnMount ? 'reconnecting' : 'disconnected',\n });\n return {\n async onMount() {\n if (config._internal.ssr) {\n await config._internal.store.persist.rehydrate();\n if (config._internal.mipd) {\n config._internal.connectors.setState((connectors) => {\n const rdnsSet = new Set();\n for (const connector of connectors ?? []) {\n if (connector.rdns)\n rdnsSet.add(connector.rdns);\n }\n const mipdConnectors = [];\n const providers = config._internal.mipd?.getProviders() ?? [];\n for (const provider of providers) {\n if (rdnsSet.has(provider.info.rdns))\n continue;\n const connectorFn = config._internal.connectors.providerDetailToConnector(provider);\n const connector = config._internal.connectors.setup(connectorFn);\n mipdConnectors.push(connector);\n }\n return [...connectors, ...mipdConnectors];\n });\n }\n }\n if (reconnectOnMount)\n reconnect(config);\n else if (config.storage)\n // Reset connections that may have been hydrated from storage.\n config.setState((x) => ({\n ...x,\n connections: new Map(),\n }));\n },\n };\n}\n//# sourceMappingURL=hydrate.js.map","import { fallback as viem_fallback } from 'viem';\nexport function fallback(transports, config) {\n return viem_fallback(transports, config);\n}\n//# sourceMappingURL=fallback.js.map","'use client';\nimport { hydrate } from '@wagmi/core';\nimport { useEffect, useRef } from 'react';\nexport function Hydrate(parameters) {\n const { children, config, initialState, reconnectOnMount = true } = parameters;\n const { onMount } = hydrate(config, {\n initialState,\n reconnectOnMount,\n });\n // Hydrate for non-SSR\n if (!config._internal.ssr)\n onMount();\n // Hydrate for SSR\n const active = useRef(true);\n // biome-ignore lint/correctness/useExhaustiveDependencies: `queryKey` not required\n useEffect(() => {\n if (!active.current)\n return;\n if (!config._internal.ssr)\n return;\n onMount();\n return () => {\n active.current = false;\n };\n }, []);\n return children;\n}\n//# sourceMappingURL=hydrate.js.map","'use client';\nimport { createContext, createElement } from 'react';\nimport { Hydrate } from './hydrate.js';\nexport const WagmiContext = createContext(undefined);\nexport function WagmiProvider(parameters) {\n const { children, config } = parameters;\n const props = { value: config };\n return createElement(Hydrate, parameters, createElement(WagmiContext.Provider, props, children));\n}\n//# sourceMappingURL=context.js.map","export const version = '2.12.22';\n//# sourceMappingURL=version.js.map","import { version } from '../version.js';\nexport const getVersion = () => `wagmi@${version}`;\n//# sourceMappingURL=getVersion.js.map","import { BaseError as CoreError } from '@wagmi/core';\nimport { getVersion } from '../utils/getVersion.js';\nexport class BaseError extends CoreError {\n constructor() {\n super(...arguments);\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'WagmiError'\n });\n }\n get docsBaseUrl() {\n return 'https://wagmi.sh/react';\n }\n get version() {\n return getVersion();\n }\n}\n//# sourceMappingURL=base.js.map","import { BaseError } from './base.js';\nexport class WagmiProviderNotFoundError extends BaseError {\n constructor() {\n super('`useConfig` must be used within `WagmiProvider`.', {\n docsPath: '/api/WagmiProvider',\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'WagmiProviderNotFoundError'\n });\n }\n}\n//# sourceMappingURL=context.js.map","'use client';\nimport { useContext } from 'react';\nimport { WagmiContext } from '../context.js';\nimport { WagmiProviderNotFoundError } from '../errors/context.js';\n/** https://wagmi.sh/react/api/hooks/useConfig */\nexport function useConfig(parameters = {}) {\n const config = parameters.config ?? useContext(WagmiContext);\n if (!config)\n throw new WagmiProviderNotFoundError();\n return config;\n}\n//# sourceMappingURL=useConfig.js.map","/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n","'use client';\nimport { deepEqual } from '@wagmi/core/internal';\nimport { useMemo, useRef } from 'react';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector.js';\nconst isPlainObject = (obj) => typeof obj === 'object' && !Array.isArray(obj);\nexport function useSyncExternalStoreWithTracked(subscribe, getSnapshot, getServerSnapshot = getSnapshot, isEqual = deepEqual) {\n const trackedKeys = useRef([]);\n const result = useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, (x) => x, (a, b) => {\n if (isPlainObject(a) && isPlainObject(b) && trackedKeys.current.length) {\n for (const key of trackedKeys.current) {\n const equal = isEqual(a[key], b[key]);\n if (!equal)\n return false;\n }\n return true;\n }\n return isEqual(a, b);\n });\n return useMemo(() => {\n if (isPlainObject(result)) {\n const trackedResult = { ...result };\n let properties = {};\n for (const [key, value] of Object.entries(trackedResult)) {\n properties = {\n ...properties,\n [key]: {\n configurable: false,\n enumerable: true,\n get: () => {\n if (!trackedKeys.current.includes(key)) {\n trackedKeys.current.push(key);\n }\n return value;\n },\n },\n };\n }\n Object.defineProperties(trackedResult, properties);\n return trackedResult;\n }\n return result;\n }, [result]);\n}\n//# sourceMappingURL=useSyncExternalStoreWithTracked.js.map","'use client';\nimport { getAccount, watchAccount, } from '@wagmi/core';\nimport { useConfig } from './useConfig.js';\nimport { useSyncExternalStoreWithTracked } from './useSyncExternalStoreWithTracked.js';\n/** https://wagmi.sh/react/api/hooks/useAccount */\nexport function useAccount(parameters = {}) {\n const config = useConfig(parameters);\n return useSyncExternalStoreWithTracked((onChange) => watchAccount(config, { onChange }), () => getAccount(config));\n}\n//# sourceMappingURL=useAccount.js.map","// src/subscribable.ts\nvar Subscribable = class {\n constructor() {\n this.listeners = /* @__PURE__ */ new Set();\n this.subscribe = this.subscribe.bind(this);\n }\n subscribe(listener) {\n this.listeners.add(listener);\n this.onSubscribe();\n return () => {\n this.listeners.delete(listener);\n this.onUnsubscribe();\n };\n }\n hasListeners() {\n return this.listeners.size > 0;\n }\n onSubscribe() {\n }\n onUnsubscribe() {\n }\n};\nexport {\n Subscribable\n};\n//# sourceMappingURL=subscribable.js.map","// src/utils.ts\nvar isServer = typeof window === \"undefined\" || \"Deno\" in globalThis;\nfunction noop() {\n return void 0;\n}\nfunction functionalUpdate(updater, input) {\n return typeof updater === \"function\" ? updater(input) : updater;\n}\nfunction isValidTimeout(value) {\n return typeof value === \"number\" && value >= 0 && value !== Infinity;\n}\nfunction timeUntilStale(updatedAt, staleTime) {\n return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);\n}\nfunction resolveStaleTime(staleTime, query) {\n return typeof staleTime === \"function\" ? staleTime(query) : staleTime;\n}\nfunction resolveEnabled(enabled, query) {\n return typeof enabled === \"function\" ? enabled(query) : enabled;\n}\nfunction matchQuery(filters, query) {\n const {\n type = \"all\",\n exact,\n fetchStatus,\n predicate,\n queryKey,\n stale\n } = filters;\n if (queryKey) {\n if (exact) {\n if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {\n return false;\n }\n } else if (!partialMatchKey(query.queryKey, queryKey)) {\n return false;\n }\n }\n if (type !== \"all\") {\n const isActive = query.isActive();\n if (type === \"active\" && !isActive) {\n return false;\n }\n if (type === \"inactive\" && isActive) {\n return false;\n }\n }\n if (typeof stale === \"boolean\" && query.isStale() !== stale) {\n return false;\n }\n if (fetchStatus && fetchStatus !== query.state.fetchStatus) {\n return false;\n }\n if (predicate && !predicate(query)) {\n return false;\n }\n return true;\n}\nfunction matchMutation(filters, mutation) {\n const { exact, status, predicate, mutationKey } = filters;\n if (mutationKey) {\n if (!mutation.options.mutationKey) {\n return false;\n }\n if (exact) {\n if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) {\n return false;\n }\n } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {\n return false;\n }\n }\n if (status && mutation.state.status !== status) {\n return false;\n }\n if (predicate && !predicate(mutation)) {\n return false;\n }\n return true;\n}\nfunction hashQueryKeyByOptions(queryKey, options) {\n const hashFn = options?.queryKeyHashFn || hashKey;\n return hashFn(queryKey);\n}\nfunction hashKey(queryKey) {\n return JSON.stringify(\n queryKey,\n (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {\n result[key] = val[key];\n return result;\n }, {}) : val\n );\n}\nfunction partialMatchKey(a, b) {\n if (a === b) {\n return true;\n }\n if (typeof a !== typeof b) {\n return false;\n }\n if (a && b && typeof a === \"object\" && typeof b === \"object\") {\n return !Object.keys(b).some((key) => !partialMatchKey(a[key], b[key]));\n }\n return false;\n}\nfunction replaceEqualDeep(a, b) {\n if (a === b) {\n return a;\n }\n const array = isPlainArray(a) && isPlainArray(b);\n if (array || isPlainObject(a) && isPlainObject(b)) {\n const aItems = array ? a : Object.keys(a);\n const aSize = aItems.length;\n const bItems = array ? b : Object.keys(b);\n const bSize = bItems.length;\n const copy = array ? [] : {};\n let equalItems = 0;\n for (let i = 0; i < bSize; i++) {\n const key = array ? i : bItems[i];\n if ((!array && aItems.includes(key) || array) && a[key] === void 0 && b[key] === void 0) {\n copy[key] = void 0;\n equalItems++;\n } else {\n copy[key] = replaceEqualDeep(a[key], b[key]);\n if (copy[key] === a[key] && a[key] !== void 0) {\n equalItems++;\n }\n }\n }\n return aSize === bSize && equalItems === aSize ? a : copy;\n }\n return b;\n}\nfunction shallowEqualObjects(a, b) {\n if (!b || Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n for (const key in a) {\n if (a[key] !== b[key]) {\n return false;\n }\n }\n return true;\n}\nfunction isPlainArray(value) {\n return Array.isArray(value) && value.length === Object.keys(value).length;\n}\nfunction isPlainObject(o) {\n if (!hasObjectPrototype(o)) {\n return false;\n }\n const ctor = o.constructor;\n if (ctor === void 0) {\n return true;\n }\n const prot = ctor.prototype;\n if (!hasObjectPrototype(prot)) {\n return false;\n }\n if (!prot.hasOwnProperty(\"isPrototypeOf\")) {\n return false;\n }\n if (Object.getPrototypeOf(o) !== Object.prototype) {\n return false;\n }\n return true;\n}\nfunction hasObjectPrototype(o) {\n return Object.prototype.toString.call(o) === \"[object Object]\";\n}\nfunction sleep(timeout) {\n return new Promise((resolve) => {\n setTimeout(resolve, timeout);\n });\n}\nfunction replaceData(prevData, data, options) {\n if (typeof options.structuralSharing === \"function\") {\n return options.structuralSharing(prevData, data);\n } else if (options.structuralSharing !== false) {\n if (process.env.NODE_ENV !== \"production\") {\n try {\n return replaceEqualDeep(prevData, data);\n } catch (error) {\n console.error(\n `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`\n );\n }\n }\n return replaceEqualDeep(prevData, data);\n }\n return data;\n}\nfunction keepPreviousData(previousData) {\n return previousData;\n}\nfunction addToEnd(items, item, max = 0) {\n const newItems = [...items, item];\n return max && newItems.length > max ? newItems.slice(1) : newItems;\n}\nfunction addToStart(items, item, max = 0) {\n const newItems = [item, ...items];\n return max && newItems.length > max ? newItems.slice(0, -1) : newItems;\n}\nvar skipToken = Symbol();\nfunction ensureQueryFn(options, fetchOptions) {\n if (process.env.NODE_ENV !== \"production\") {\n if (options.queryFn === skipToken) {\n console.error(\n `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`\n );\n }\n }\n if (!options.queryFn && fetchOptions?.initialPromise) {\n return () => fetchOptions.initialPromise;\n }\n if (!options.queryFn || options.queryFn === skipToken) {\n return () => Promise.reject(new Error(`Missing queryFn: '${options.queryHash}'`));\n }\n return options.queryFn;\n}\nexport {\n addToEnd,\n addToStart,\n ensureQueryFn,\n functionalUpdate,\n hashKey,\n hashQueryKeyByOptions,\n isPlainArray,\n isPlainObject,\n isServer,\n isValidTimeout,\n keepPreviousData,\n matchMutation,\n matchQuery,\n noop,\n partialMatchKey,\n replaceData,\n replaceEqualDeep,\n resolveEnabled,\n resolveStaleTime,\n shallowEqualObjects,\n skipToken,\n sleep,\n timeUntilStale\n};\n//# sourceMappingURL=utils.js.map","// src/focusManager.ts\nimport { Subscribable } from \"./subscribable.js\";\nimport { isServer } from \"./utils.js\";\nvar FocusManager = class extends Subscribable {\n #focused;\n #cleanup;\n #setup;\n constructor() {\n super();\n this.#setup = (onFocus) => {\n if (!isServer && window.addEventListener) {\n const listener = () => onFocus();\n window.addEventListener(\"visibilitychange\", listener, false);\n return () => {\n window.removeEventListener(\"visibilitychange\", listener);\n };\n }\n return;\n };\n }\n onSubscribe() {\n if (!this.#cleanup) {\n this.setEventListener(this.#setup);\n }\n }\n onUnsubscribe() {\n if (!this.hasListeners()) {\n this.#cleanup?.();\n this.#cleanup = void 0;\n }\n }\n setEventListener(setup) {\n this.#setup = setup;\n this.#cleanup?.();\n this.#cleanup = setup((focused) => {\n if (typeof focused === \"boolean\") {\n this.setFocused(focused);\n } else {\n this.onFocus();\n }\n });\n }\n setFocused(focused) {\n const changed = this.#focused !== focused;\n if (changed) {\n this.#focused = focused;\n this.onFocus();\n }\n }\n onFocus() {\n const isFocused = this.isFocused();\n this.listeners.forEach((listener) => {\n listener(isFocused);\n });\n }\n isFocused() {\n if (typeof this.#focused === \"boolean\") {\n return this.#focused;\n }\n return globalThis.document?.visibilityState !== \"hidden\";\n }\n};\nvar focusManager = new FocusManager();\nexport {\n FocusManager,\n focusManager\n};\n//# sourceMappingURL=focusManager.js.map","// src/onlineManager.ts\nimport { Subscribable } from \"./subscribable.js\";\nimport { isServer } from \"./utils.js\";\nvar OnlineManager = class extends Subscribable {\n #online = true;\n #cleanup;\n #setup;\n constructor() {\n super();\n this.#setup = (onOnline) => {\n if (!isServer && window.addEventListener) {\n const onlineListener = () => onOnline(true);\n const offlineListener = () => onOnline(false);\n window.addEventListener(\"online\", onlineListener, false);\n window.addEventListener(\"offline\", offlineListener, false);\n return () => {\n window.removeEventListener(\"online\", onlineListener);\n window.removeEventListener(\"offline\", offlineListener);\n };\n }\n return;\n };\n }\n onSubscribe() {\n if (!this.#cleanup) {\n this.setEventListener(this.#setup);\n }\n }\n onUnsubscribe() {\n if (!this.hasListeners()) {\n this.#cleanup?.();\n this.#cleanup = void 0;\n }\n }\n setEventListener(setup) {\n this.#setup = setup;\n this.#cleanup?.();\n this.#cleanup = setup(this.setOnline.bind(this));\n }\n setOnline(online) {\n const changed = this.#online !== online;\n if (changed) {\n this.#online = online;\n this.listeners.forEach((listener) => {\n listener(online);\n });\n }\n }\n isOnline() {\n return this.#online;\n }\n};\nvar onlineManager = new OnlineManager();\nexport {\n OnlineManager,\n onlineManager\n};\n//# sourceMappingURL=onlineManager.js.map","// src/thenable.ts\nfunction pendingThenable() {\n let resolve;\n let reject;\n const thenable = new Promise((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n thenable.status = \"pending\";\n thenable.catch(() => {\n });\n function finalize(data) {\n Object.assign(thenable, data);\n delete thenable.resolve;\n delete thenable.reject;\n }\n thenable.resolve = (value) => {\n finalize({\n status: \"fulfilled\",\n value\n });\n resolve(value);\n };\n thenable.reject = (reason) => {\n finalize({\n status: \"rejected\",\n reason\n });\n reject(reason);\n };\n return thenable;\n}\nexport {\n pendingThenable\n};\n//# sourceMappingURL=thenable.js.map","// src/retryer.ts\nimport { focusManager } from \"./focusManager.js\";\nimport { onlineManager } from \"./onlineManager.js\";\nimport { pendingThenable } from \"./thenable.js\";\nimport { isServer, sleep } from \"./utils.js\";\nfunction defaultRetryDelay(failureCount) {\n return Math.min(1e3 * 2 ** failureCount, 3e4);\n}\nfunction canFetch(networkMode) {\n return (networkMode ?? \"online\") === \"online\" ? onlineManager.isOnline() : true;\n}\nvar CancelledError = class extends Error {\n constructor(options) {\n super(\"CancelledError\");\n this.revert = options?.revert;\n this.silent = options?.silent;\n }\n};\nfunction isCancelledError(value) {\n return value instanceof CancelledError;\n}\nfunction createRetryer(config) {\n let isRetryCancelled = false;\n let failureCount = 0;\n let isResolved = false;\n let continueFn;\n const thenable = pendingThenable();\n const cancel = (cancelOptions) => {\n if (!isResolved) {\n reject(new CancelledError(cancelOptions));\n config.abort?.();\n }\n };\n const cancelRetry = () => {\n isRetryCancelled = true;\n };\n const continueRetry = () => {\n isRetryCancelled = false;\n };\n const canContinue = () => focusManager.isFocused() && (config.networkMode === \"always\" || onlineManager.isOnline()) && config.canRun();\n const canStart = () => canFetch(config.networkMode) && config.canRun();\n const resolve = (value) => {\n if (!isResolved) {\n isResolved = true;\n config.onSuccess?.(value);\n continueFn?.();\n thenable.resolve(value);\n }\n };\n const reject = (value) => {\n if (!isResolved) {\n isResolved = true;\n config.onError?.(value);\n continueFn?.();\n thenable.reject(value);\n }\n };\n const pause = () => {\n return new Promise((continueResolve) => {\n continueFn = (value) => {\n if (isResolved || canContinue()) {\n continueResolve(value);\n }\n };\n config.onPause?.();\n }).then(() => {\n continueFn = void 0;\n if (!isResolved) {\n config.onContinue?.();\n }\n });\n };\n const run = () => {\n if (isResolved) {\n return;\n }\n let promiseOrValue;\n const initialPromise = failureCount === 0 ? config.initialPromise : void 0;\n try {\n promiseOrValue = initialPromise ?? config.fn();\n } catch (error) {\n promiseOrValue = Promise.reject(error);\n }\n Promise.resolve(promiseOrValue).then(resolve).catch((error) => {\n if (isResolved) {\n return;\n }\n const retry = config.retry ?? (isServer ? 0 : 3);\n const retryDelay = config.retryDelay ?? defaultRetryDelay;\n const delay = typeof retryDelay === \"function\" ? retryDelay(failureCount, error) : retryDelay;\n const shouldRetry = retry === true || typeof retry === \"number\" && failureCount < retry || typeof retry === \"function\" && retry(failureCount, error);\n if (isRetryCancelled || !shouldRetry) {\n reject(error);\n return;\n }\n failureCount++;\n config.onFail?.(failureCount, error);\n sleep(delay).then(() => {\n return canContinue() ? void 0 : pause();\n }).then(() => {\n if (isRetryCancelled) {\n reject(error);\n } else {\n run();\n }\n });\n });\n };\n return {\n promise: thenable,\n cancel,\n continue: () => {\n continueFn?.();\n return thenable;\n },\n cancelRetry,\n continueRetry,\n canStart,\n start: () => {\n if (canStart()) {\n run();\n } else {\n pause().then(run);\n }\n return thenable;\n }\n };\n}\nexport {\n CancelledError,\n canFetch,\n createRetryer,\n isCancelledError\n};\n//# sourceMappingURL=retryer.js.map","// src/notifyManager.ts\nfunction createNotifyManager() {\n let queue = [];\n let transactions = 0;\n let notifyFn = (callback) => {\n callback();\n };\n let batchNotifyFn = (callback) => {\n callback();\n };\n let scheduleFn = (cb) => setTimeout(cb, 0);\n const schedule = (callback) => {\n if (transactions) {\n queue.push(callback);\n } else {\n scheduleFn(() => {\n notifyFn(callback);\n });\n }\n };\n const flush = () => {\n const originalQueue = queue;\n queue = [];\n if (originalQueue.length) {\n scheduleFn(() => {\n batchNotifyFn(() => {\n originalQueue.forEach((callback) => {\n notifyFn(callback);\n });\n });\n });\n }\n };\n return {\n batch: (callback) => {\n let result;\n transactions++;\n try {\n result = callback();\n } finally {\n transactions--;\n if (!transactions) {\n flush();\n }\n }\n return result;\n },\n /**\n * All calls to the wrapped function will be batched.\n */\n batchCalls: (callback) => {\n return (...args) => {\n schedule(() => {\n callback(...args);\n });\n };\n },\n schedule,\n /**\n * Use this method to set a custom notify function.\n * This can be used to for example wrap notifications with `React.act` while running tests.\n */\n setNotifyFunction: (fn) => {\n notifyFn = fn;\n },\n /**\n * Use this method to set a custom function to batch notifications together into a single tick.\n * By default React Query will use the batch function provided by ReactDOM or React Native.\n */\n setBatchNotifyFunction: (fn) => {\n batchNotifyFn = fn;\n },\n setScheduler: (fn) => {\n scheduleFn = fn;\n }\n };\n}\nvar notifyManager = createNotifyManager();\nexport {\n createNotifyManager,\n notifyManager\n};\n//# sourceMappingURL=notifyManager.js.map","// src/removable.ts\nimport { isServer, isValidTimeout } from \"./utils.js\";\nvar Removable = class {\n #gcTimeout;\n destroy() {\n this.clearGcTimeout();\n }\n scheduleGc() {\n this.clearGcTimeout();\n if (isValidTimeout(this.gcTime)) {\n this.#gcTimeout = setTimeout(() => {\n this.optionalRemove();\n }, this.gcTime);\n }\n }\n updateGcTime(newGcTime) {\n this.gcTime = Math.max(\n this.gcTime || 0,\n newGcTime ?? (isServer ? Infinity : 5 * 60 * 1e3)\n );\n }\n clearGcTimeout() {\n if (this.#gcTimeout) {\n clearTimeout(this.#gcTimeout);\n this.#gcTimeout = void 0;\n }\n }\n};\nexport {\n Removable\n};\n//# sourceMappingURL=removable.js.map","// src/query.ts\nimport {\n ensureQueryFn,\n noop,\n replaceData,\n resolveEnabled,\n skipToken,\n timeUntilStale\n} from \"./utils.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { canFetch, createRetryer, isCancelledError } from \"./retryer.js\";\nimport { Removable } from \"./removable.js\";\nvar Query = class extends Removable {\n #initialState;\n #revertState;\n #cache;\n #retryer;\n #defaultOptions;\n #abortSignalConsumed;\n constructor(config) {\n super();\n this.#abortSignalConsumed = false;\n this.#defaultOptions = config.defaultOptions;\n this.setOptions(config.options);\n this.observers = [];\n this.#cache = config.cache;\n this.queryKey = config.queryKey;\n this.queryHash = config.queryHash;\n this.#initialState = getDefaultState(this.options);\n this.state = config.state ?? this.#initialState;\n this.scheduleGc();\n }\n get meta() {\n return this.options.meta;\n }\n get promise() {\n return this.#retryer?.promise;\n }\n setOptions(options) {\n this.options = { ...this.#defaultOptions, ...options };\n this.updateGcTime(this.options.gcTime);\n }\n optionalRemove() {\n if (!this.observers.length && this.state.fetchStatus === \"idle\") {\n this.#cache.remove(this);\n }\n }\n setData(newData, options) {\n const data = replaceData(this.state.data, newData, this.options);\n this.#dispatch({\n data,\n type: \"success\",\n dataUpdatedAt: options?.updatedAt,\n manual: options?.manual\n });\n return data;\n }\n setState(state, setStateOptions) {\n this.#dispatch({ type: \"setState\", state, setStateOptions });\n }\n cancel(options) {\n const promise = this.#retryer?.promise;\n this.#retryer?.cancel(options);\n return promise ? promise.then(noop).catch(noop) : Promise.resolve();\n }\n destroy() {\n super.destroy();\n this.cancel({ silent: true });\n }\n reset() {\n this.destroy();\n this.setState(this.#initialState);\n }\n isActive() {\n return this.observers.some(\n (observer) => resolveEnabled(observer.options.enabled, this) !== false\n );\n }\n isDisabled() {\n if (this.getObserversCount() > 0) {\n return !this.isActive();\n }\n return this.options.queryFn === skipToken || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;\n }\n isStale() {\n if (this.state.isInvalidated) {\n return true;\n }\n if (this.getObserversCount() > 0) {\n return this.observers.some(\n (observer) => observer.getCurrentResult().isStale\n );\n }\n return this.state.data === void 0;\n }\n isStaleByTime(staleTime = 0) {\n return this.state.isInvalidated || this.state.data === void 0 || !timeUntilStale(this.state.dataUpdatedAt, staleTime);\n }\n onFocus() {\n const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus());\n observer?.refetch({ cancelRefetch: false });\n this.#retryer?.continue();\n }\n onOnline() {\n const observer = this.observers.find((x) => x.shouldFetchOnReconnect());\n observer?.refetch({ cancelRefetch: false });\n this.#retryer?.continue();\n }\n addObserver(observer) {\n if (!this.observers.includes(observer)) {\n this.observers.push(observer);\n this.clearGcTimeout();\n this.#cache.notify({ type: \"observerAdded\", query: this, observer });\n }\n }\n removeObserver(observer) {\n if (this.observers.includes(observer)) {\n this.observers = this.observers.filter((x) => x !== observer);\n if (!this.observers.length) {\n if (this.#retryer) {\n if (this.#abortSignalConsumed) {\n this.#retryer.cancel({ revert: true });\n } else {\n this.#retryer.cancelRetry();\n }\n }\n this.scheduleGc();\n }\n this.#cache.notify({ type: \"observerRemoved\", query: this, observer });\n }\n }\n getObserversCount() {\n return this.observers.length;\n }\n invalidate() {\n if (!this.state.isInvalidated) {\n this.#dispatch({ type: \"invalidate\" });\n }\n }\n fetch(options, fetchOptions) {\n if (this.state.fetchStatus !== \"idle\") {\n if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) {\n this.cancel({ silent: true });\n } else if (this.#retryer) {\n this.#retryer.continueRetry();\n return this.#retryer.promise;\n }\n }\n if (options) {\n this.setOptions(options);\n }\n if (!this.options.queryFn) {\n const observer = this.observers.find((x) => x.options.queryFn);\n if (observer) {\n this.setOptions(observer.options);\n }\n }\n if (process.env.NODE_ENV !== \"production\") {\n if (!Array.isArray(this.options.queryKey)) {\n console.error(\n `As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`\n );\n }\n }\n const abortController = new AbortController();\n const addSignalProperty = (object) => {\n Object.defineProperty(object, \"signal\", {\n enumerable: true,\n get: () => {\n this.#abortSignalConsumed = true;\n return abortController.signal;\n }\n });\n };\n const fetchFn = () => {\n const queryFn = ensureQueryFn(this.options, fetchOptions);\n const queryFnContext = {\n queryKey: this.queryKey,\n meta: this.meta\n };\n addSignalProperty(queryFnContext);\n this.#abortSignalConsumed = false;\n if (this.options.persister) {\n return this.options.persister(\n queryFn,\n queryFnContext,\n this\n );\n }\n return queryFn(queryFnContext);\n };\n const context = {\n fetchOptions,\n options: this.options,\n queryKey: this.queryKey,\n state: this.state,\n fetchFn\n };\n addSignalProperty(context);\n this.options.behavior?.onFetch(\n context,\n this\n );\n this.#revertState = this.state;\n if (this.state.fetchStatus === \"idle\" || this.state.fetchMeta !== context.fetchOptions?.meta) {\n this.#dispatch({ type: \"fetch\", meta: context.fetchOptions?.meta });\n }\n const onError = (error) => {\n if (!(isCancelledError(error) && error.silent)) {\n this.#dispatch({\n type: \"error\",\n error\n });\n }\n if (!isCancelledError(error)) {\n this.#cache.config.onError?.(\n error,\n this\n );\n this.#cache.config.onSettled?.(\n this.state.data,\n error,\n this\n );\n }\n this.scheduleGc();\n };\n this.#retryer = createRetryer({\n initialPromise: fetchOptions?.initialPromise,\n fn: context.fetchFn,\n abort: abortController.abort.bind(abortController),\n onSuccess: (data) => {\n if (data === void 0) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\n `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`\n );\n }\n onError(new Error(`${this.queryHash} data is undefined`));\n return;\n }\n try {\n this.setData(data);\n } catch (error) {\n onError(error);\n return;\n }\n this.#cache.config.onSuccess?.(data, this);\n this.#cache.config.onSettled?.(\n data,\n this.state.error,\n this\n );\n this.scheduleGc();\n },\n onError,\n onFail: (failureCount, error) => {\n this.#dispatch({ type: \"failed\", failureCount, error });\n },\n onPause: () => {\n this.#dispatch({ type: \"pause\" });\n },\n onContinue: () => {\n this.#dispatch({ type: \"continue\" });\n },\n retry: context.options.retry,\n retryDelay: context.options.retryDelay,\n networkMode: context.options.networkMode,\n canRun: () => true\n });\n return this.#retryer.start();\n }\n #dispatch(action) {\n const reducer = (state) => {\n switch (action.type) {\n case \"failed\":\n return {\n ...state,\n fetchFailureCount: action.failureCount,\n fetchFailureReason: action.error\n };\n case \"pause\":\n return {\n ...state,\n fetchStatus: \"paused\"\n };\n case \"continue\":\n return {\n ...state,\n fetchStatus: \"fetching\"\n };\n case \"fetch\":\n return {\n ...state,\n ...fetchState(state.data, this.options),\n fetchMeta: action.meta ?? null\n };\n case \"success\":\n return {\n ...state,\n data: action.data,\n dataUpdateCount: state.dataUpdateCount + 1,\n dataUpdatedAt: action.dataUpdatedAt ?? Date.now(),\n error: null,\n isInvalidated: false,\n status: \"success\",\n ...!action.manual && {\n fetchStatus: \"idle\",\n fetchFailureCount: 0,\n fetchFailureReason: null\n }\n };\n case \"error\":\n const error = action.error;\n if (isCancelledError(error) && error.revert && this.#revertState) {\n return { ...this.#revertState, fetchStatus: \"idle\" };\n }\n return {\n ...state,\n error,\n errorUpdateCount: state.errorUpdateCount + 1,\n errorUpdatedAt: Date.now(),\n fetchFailureCount: state.fetchFailureCount + 1,\n fetchFailureReason: error,\n fetchStatus: \"idle\",\n status: \"error\"\n };\n case \"invalidate\":\n return {\n ...state,\n isInvalidated: true\n };\n case \"setState\":\n return {\n ...state,\n ...action.state\n };\n }\n };\n this.state = reducer(this.state);\n notifyManager.batch(() => {\n this.observers.forEach((observer) => {\n observer.onQueryUpdate();\n });\n this.#cache.notify({ query: this, type: \"updated\", action });\n });\n }\n};\nfunction fetchState(data, options) {\n return {\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchStatus: canFetch(options.networkMode) ? \"fetching\" : \"paused\",\n ...data === void 0 && {\n error: null,\n status: \"pending\"\n }\n };\n}\nfunction getDefaultState(options) {\n const data = typeof options.initialData === \"function\" ? options.initialData() : options.initialData;\n const hasData = data !== void 0;\n const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === \"function\" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;\n return {\n data,\n dataUpdateCount: 0,\n dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,\n error: null,\n errorUpdateCount: 0,\n errorUpdatedAt: 0,\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchMeta: null,\n isInvalidated: false,\n status: hasData ? \"success\" : \"pending\",\n fetchStatus: \"idle\"\n };\n}\nexport {\n Query,\n fetchState\n};\n//# sourceMappingURL=query.js.map","// src/queryCache.ts\nimport { hashQueryKeyByOptions, matchQuery } from \"./utils.js\";\nimport { Query } from \"./query.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Subscribable } from \"./subscribable.js\";\nvar QueryCache = class extends Subscribable {\n constructor(config = {}) {\n super();\n this.config = config;\n this.#queries = /* @__PURE__ */ new Map();\n }\n #queries;\n build(client, options, state) {\n const queryKey = options.queryKey;\n const queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);\n let query = this.get(queryHash);\n if (!query) {\n query = new Query({\n cache: this,\n queryKey,\n queryHash,\n options: client.defaultQueryOptions(options),\n state,\n defaultOptions: client.getQueryDefaults(queryKey)\n });\n this.add(query);\n }\n return query;\n }\n add(query) {\n if (!this.#queries.has(query.queryHash)) {\n this.#queries.set(query.queryHash, query);\n this.notify({\n type: \"added\",\n query\n });\n }\n }\n remove(query) {\n const queryInMap = this.#queries.get(query.queryHash);\n if (queryInMap) {\n query.destroy();\n if (queryInMap === query) {\n this.#queries.delete(query.queryHash);\n }\n this.notify({ type: \"removed\", query });\n }\n }\n clear() {\n notifyManager.batch(() => {\n this.getAll().forEach((query) => {\n this.remove(query);\n });\n });\n }\n get(queryHash) {\n return this.#queries.get(queryHash);\n }\n getAll() {\n return [...this.#queries.values()];\n }\n find(filters) {\n const defaultedFilters = { exact: true, ...filters };\n return this.getAll().find(\n (query) => matchQuery(defaultedFilters, query)\n );\n }\n findAll(filters = {}) {\n const queries = this.getAll();\n return Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;\n }\n notify(event) {\n notifyManager.batch(() => {\n this.listeners.forEach((listener) => {\n listener(event);\n });\n });\n }\n onFocus() {\n notifyManager.batch(() => {\n this.getAll().forEach((query) => {\n query.onFocus();\n });\n });\n }\n onOnline() {\n notifyManager.batch(() => {\n this.getAll().forEach((query) => {\n query.onOnline();\n });\n });\n }\n};\nexport {\n QueryCache\n};\n//# sourceMappingURL=queryCache.js.map","// src/mutation.ts\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Removable } from \"./removable.js\";\nimport { createRetryer } from \"./retryer.js\";\nvar Mutation = class extends Removable {\n #observers;\n #mutationCache;\n #retryer;\n constructor(config) {\n super();\n this.mutationId = config.mutationId;\n this.#mutationCache = config.mutationCache;\n this.#observers = [];\n this.state = config.state || getDefaultState();\n this.setOptions(config.options);\n this.scheduleGc();\n }\n setOptions(options) {\n this.options = options;\n this.updateGcTime(this.options.gcTime);\n }\n get meta() {\n return this.options.meta;\n }\n addObserver(observer) {\n if (!this.#observers.includes(observer)) {\n this.#observers.push(observer);\n this.clearGcTimeout();\n this.#mutationCache.notify({\n type: \"observerAdded\",\n mutation: this,\n observer\n });\n }\n }\n removeObserver(observer) {\n this.#observers = this.#observers.filter((x) => x !== observer);\n this.scheduleGc();\n this.#mutationCache.notify({\n type: \"observerRemoved\",\n mutation: this,\n observer\n });\n }\n optionalRemove() {\n if (!this.#observers.length) {\n if (this.state.status === \"pending\") {\n this.scheduleGc();\n } else {\n this.#mutationCache.remove(this);\n }\n }\n }\n continue() {\n return this.#retryer?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before\n this.execute(this.state.variables);\n }\n async execute(variables) {\n this.#retryer = createRetryer({\n fn: () => {\n if (!this.options.mutationFn) {\n return Promise.reject(new Error(\"No mutationFn found\"));\n }\n return this.options.mutationFn(variables);\n },\n onFail: (failureCount, error) => {\n this.#dispatch({ type: \"failed\", failureCount, error });\n },\n onPause: () => {\n this.#dispatch({ type: \"pause\" });\n },\n onContinue: () => {\n this.#dispatch({ type: \"continue\" });\n },\n retry: this.options.retry ?? 0,\n retryDelay: this.options.retryDelay,\n networkMode: this.options.networkMode,\n canRun: () => this.#mutationCache.canRun(this)\n });\n const restored = this.state.status === \"pending\";\n const isPaused = !this.#retryer.canStart();\n try {\n if (!restored) {\n this.#dispatch({ type: \"pending\", variables, isPaused });\n await this.#mutationCache.config.onMutate?.(\n variables,\n this\n );\n const context = await this.options.onMutate?.(variables);\n if (context !== this.state.context) {\n this.#dispatch({\n type: \"pending\",\n context,\n variables,\n isPaused\n });\n }\n }\n const data = await this.#retryer.start();\n await this.#mutationCache.config.onSuccess?.(\n data,\n variables,\n this.state.context,\n this\n );\n await this.options.onSuccess?.(data, variables, this.state.context);\n await this.#mutationCache.config.onSettled?.(\n data,\n null,\n this.state.variables,\n this.state.context,\n this\n );\n await this.options.onSettled?.(data, null, variables, this.state.context);\n this.#dispatch({ type: \"success\", data });\n return data;\n } catch (error) {\n try {\n await this.#mutationCache.config.onError?.(\n error,\n variables,\n this.state.context,\n this\n );\n await this.options.onError?.(\n error,\n variables,\n this.state.context\n );\n await this.#mutationCache.config.onSettled?.(\n void 0,\n error,\n this.state.variables,\n this.state.context,\n this\n );\n await this.options.onSettled?.(\n void 0,\n error,\n variables,\n this.state.context\n );\n throw error;\n } finally {\n this.#dispatch({ type: \"error\", error });\n }\n } finally {\n this.#mutationCache.runNext(this);\n }\n }\n #dispatch(action) {\n const reducer = (state) => {\n switch (action.type) {\n case \"failed\":\n return {\n ...state,\n failureCount: action.failureCount,\n failureReason: action.error\n };\n case \"pause\":\n return {\n ...state,\n isPaused: true\n };\n case \"continue\":\n return {\n ...state,\n isPaused: false\n };\n case \"pending\":\n return {\n ...state,\n context: action.context,\n data: void 0,\n failureCount: 0,\n failureReason: null,\n error: null,\n isPaused: action.isPaused,\n status: \"pending\",\n variables: action.variables,\n submittedAt: Date.now()\n };\n case \"success\":\n return {\n ...state,\n data: action.data,\n failureCount: 0,\n failureReason: null,\n error: null,\n status: \"success\",\n isPaused: false\n };\n case \"error\":\n return {\n ...state,\n data: void 0,\n error: action.error,\n failureCount: state.failureCount + 1,\n failureReason: action.error,\n isPaused: false,\n status: \"error\"\n };\n }\n };\n this.state = reducer(this.state);\n notifyManager.batch(() => {\n this.#observers.forEach((observer) => {\n observer.onMutationUpdate(action);\n });\n this.#mutationCache.notify({\n mutation: this,\n type: \"updated\",\n action\n });\n });\n }\n};\nfunction getDefaultState() {\n return {\n context: void 0,\n data: void 0,\n error: null,\n failureCount: 0,\n failureReason: null,\n isPaused: false,\n status: \"idle\",\n variables: void 0,\n submittedAt: 0\n };\n}\nexport {\n Mutation,\n getDefaultState\n};\n//# sourceMappingURL=mutation.js.map","// src/mutationCache.ts\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Mutation } from \"./mutation.js\";\nimport { matchMutation, noop } from \"./utils.js\";\nimport { Subscribable } from \"./subscribable.js\";\nvar MutationCache = class extends Subscribable {\n constructor(config = {}) {\n super();\n this.config = config;\n this.#mutations = /* @__PURE__ */ new Map();\n this.#mutationId = Date.now();\n }\n #mutations;\n #mutationId;\n build(client, options, state) {\n const mutation = new Mutation({\n mutationCache: this,\n mutationId: ++this.#mutationId,\n options: client.defaultMutationOptions(options),\n state\n });\n this.add(mutation);\n return mutation;\n }\n add(mutation) {\n const scope = scopeFor(mutation);\n const mutations = this.#mutations.get(scope) ?? [];\n mutations.push(mutation);\n this.#mutations.set(scope, mutations);\n this.notify({ type: \"added\", mutation });\n }\n remove(mutation) {\n const scope = scopeFor(mutation);\n if (this.#mutations.has(scope)) {\n const mutations = this.#mutations.get(scope)?.filter((x) => x !== mutation);\n if (mutations) {\n if (mutations.length === 0) {\n this.#mutations.delete(scope);\n } else {\n this.#mutations.set(scope, mutations);\n }\n }\n }\n this.notify({ type: \"removed\", mutation });\n }\n canRun(mutation) {\n const firstPendingMutation = this.#mutations.get(scopeFor(mutation))?.find((m) => m.state.status === \"pending\");\n return !firstPendingMutation || firstPendingMutation === mutation;\n }\n runNext(mutation) {\n const foundMutation = this.#mutations.get(scopeFor(mutation))?.find((m) => m !== mutation && m.state.isPaused);\n return foundMutation?.continue() ?? Promise.resolve();\n }\n clear() {\n notifyManager.batch(() => {\n this.getAll().forEach((mutation) => {\n this.remove(mutation);\n });\n });\n }\n getAll() {\n return [...this.#mutations.values()].flat();\n }\n find(filters) {\n const defaultedFilters = { exact: true, ...filters };\n return this.getAll().find(\n (mutation) => matchMutation(defaultedFilters, mutation)\n );\n }\n findAll(filters = {}) {\n return this.getAll().filter((mutation) => matchMutation(filters, mutation));\n }\n notify(event) {\n notifyManager.batch(() => {\n this.listeners.forEach((listener) => {\n listener(event);\n });\n });\n }\n resumePausedMutations() {\n const pausedMutations = this.getAll().filter((x) => x.state.isPaused);\n return notifyManager.batch(\n () => Promise.all(\n pausedMutations.map((mutation) => mutation.continue().catch(noop))\n )\n );\n }\n};\nfunction scopeFor(mutation) {\n return mutation.options.scope?.id ?? String(mutation.mutationId);\n}\nexport {\n MutationCache\n};\n//# sourceMappingURL=mutationCache.js.map","// src/infiniteQueryBehavior.ts\nimport { addToEnd, addToStart, ensureQueryFn } from \"./utils.js\";\nfunction infiniteQueryBehavior(pages) {\n return {\n onFetch: (context, query) => {\n const options = context.options;\n const direction = context.fetchOptions?.meta?.fetchMore?.direction;\n const oldPages = context.state.data?.pages || [];\n const oldPageParams = context.state.data?.pageParams || [];\n let result = { pages: [], pageParams: [] };\n let currentPage = 0;\n const fetchFn = async () => {\n let cancelled = false;\n const addSignalProperty = (object) => {\n Object.defineProperty(object, \"signal\", {\n enumerable: true,\n get: () => {\n if (context.signal.aborted) {\n cancelled = true;\n } else {\n context.signal.addEventListener(\"abort\", () => {\n cancelled = true;\n });\n }\n return context.signal;\n }\n });\n };\n const queryFn = ensureQueryFn(context.options, context.fetchOptions);\n const fetchPage = async (data, param, previous) => {\n if (cancelled) {\n return Promise.reject();\n }\n if (param == null && data.pages.length) {\n return Promise.resolve(data);\n }\n const queryFnContext = {\n queryKey: context.queryKey,\n pageParam: param,\n direction: previous ? \"backward\" : \"forward\",\n meta: context.options.meta\n };\n addSignalProperty(queryFnContext);\n const page = await queryFn(\n queryFnContext\n );\n const { maxPages } = context.options;\n const addTo = previous ? addToStart : addToEnd;\n return {\n pages: addTo(data.pages, page, maxPages),\n pageParams: addTo(data.pageParams, param, maxPages)\n };\n };\n if (direction && oldPages.length) {\n const previous = direction === \"backward\";\n const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;\n const oldData = {\n pages: oldPages,\n pageParams: oldPageParams\n };\n const param = pageParamFn(options, oldData);\n result = await fetchPage(oldData, param, previous);\n } else {\n const remainingPages = pages ?? oldPages.length;\n do {\n const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);\n if (currentPage > 0 && param == null) {\n break;\n }\n result = await fetchPage(result, param);\n currentPage++;\n } while (currentPage < remainingPages);\n }\n return result;\n };\n if (context.options.persister) {\n context.fetchFn = () => {\n return context.options.persister?.(\n fetchFn,\n {\n queryKey: context.queryKey,\n meta: context.options.meta,\n signal: context.signal\n },\n query\n );\n };\n } else {\n context.fetchFn = fetchFn;\n }\n }\n };\n}\nfunction getNextPageParam(options, { pages, pageParams }) {\n const lastIndex = pages.length - 1;\n return pages.length > 0 ? options.getNextPageParam(\n pages[lastIndex],\n pages,\n pageParams[lastIndex],\n pageParams\n ) : void 0;\n}\nfunction getPreviousPageParam(options, { pages, pageParams }) {\n return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;\n}\nfunction hasNextPage(options, data) {\n if (!data)\n return false;\n return getNextPageParam(options, data) != null;\n}\nfunction hasPreviousPage(options, data) {\n if (!data || !options.getPreviousPageParam)\n return false;\n return getPreviousPageParam(options, data) != null;\n}\nexport {\n hasNextPage,\n hasPreviousPage,\n infiniteQueryBehavior\n};\n//# sourceMappingURL=infiniteQueryBehavior.js.map","// src/queryClient.ts\nimport {\n functionalUpdate,\n hashKey,\n hashQueryKeyByOptions,\n noop,\n partialMatchKey,\n resolveStaleTime,\n skipToken\n} from \"./utils.js\";\nimport { QueryCache } from \"./queryCache.js\";\nimport { MutationCache } from \"./mutationCache.js\";\nimport { focusManager } from \"./focusManager.js\";\nimport { onlineManager } from \"./onlineManager.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { infiniteQueryBehavior } from \"./infiniteQueryBehavior.js\";\nvar QueryClient = class {\n #queryCache;\n #mutationCache;\n #defaultOptions;\n #queryDefaults;\n #mutationDefaults;\n #mountCount;\n #unsubscribeFocus;\n #unsubscribeOnline;\n constructor(config = {}) {\n this.#queryCache = config.queryCache || new QueryCache();\n this.#mutationCache = config.mutationCache || new MutationCache();\n this.#defaultOptions = config.defaultOptions || {};\n this.#queryDefaults = /* @__PURE__ */ new Map();\n this.#mutationDefaults = /* @__PURE__ */ new Map();\n this.#mountCount = 0;\n }\n mount() {\n this.#mountCount++;\n if (this.#mountCount !== 1)\n return;\n this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {\n if (focused) {\n await this.resumePausedMutations();\n this.#queryCache.onFocus();\n }\n });\n this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {\n if (online) {\n await this.resumePausedMutations();\n this.#queryCache.onOnline();\n }\n });\n }\n unmount() {\n this.#mountCount--;\n if (this.#mountCount !== 0)\n return;\n this.#unsubscribeFocus?.();\n this.#unsubscribeFocus = void 0;\n this.#unsubscribeOnline?.();\n this.#unsubscribeOnline = void 0;\n }\n isFetching(filters) {\n return this.#queryCache.findAll({ ...filters, fetchStatus: \"fetching\" }).length;\n }\n isMutating(filters) {\n return this.#mutationCache.findAll({ ...filters, status: \"pending\" }).length;\n }\n getQueryData(queryKey) {\n const options = this.defaultQueryOptions({ queryKey });\n return this.#queryCache.get(options.queryHash)?.state.data;\n }\n ensureQueryData(options) {\n const cachedData = this.getQueryData(options.queryKey);\n if (cachedData === void 0)\n return this.fetchQuery(options);\n else {\n const defaultedOptions = this.defaultQueryOptions(options);\n const query = this.#queryCache.build(this, defaultedOptions);\n if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) {\n void this.prefetchQuery(defaultedOptions);\n }\n return Promise.resolve(cachedData);\n }\n }\n getQueriesData(filters) {\n return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {\n const data = state.data;\n return [queryKey, data];\n });\n }\n setQueryData(queryKey, updater, options) {\n const defaultedOptions = this.defaultQueryOptions({ queryKey });\n const query = this.#queryCache.get(\n defaultedOptions.queryHash\n );\n const prevData = query?.state.data;\n const data = functionalUpdate(updater, prevData);\n if (data === void 0) {\n return void 0;\n }\n return this.#queryCache.build(this, defaultedOptions).setData(data, { ...options, manual: true });\n }\n setQueriesData(filters, updater, options) {\n return notifyManager.batch(\n () => this.#queryCache.findAll(filters).map(({ queryKey }) => [\n queryKey,\n this.setQueryData(queryKey, updater, options)\n ])\n );\n }\n getQueryState(queryKey) {\n const options = this.defaultQueryOptions({ queryKey });\n return this.#queryCache.get(options.queryHash)?.state;\n }\n removeQueries(filters) {\n const queryCache = this.#queryCache;\n notifyManager.batch(() => {\n queryCache.findAll(filters).forEach((query) => {\n queryCache.remove(query);\n });\n });\n }\n resetQueries(filters, options) {\n const queryCache = this.#queryCache;\n const refetchFilters = {\n type: \"active\",\n ...filters\n };\n return notifyManager.batch(() => {\n queryCache.findAll(filters).forEach((query) => {\n query.reset();\n });\n return this.refetchQueries(refetchFilters, options);\n });\n }\n cancelQueries(filters = {}, cancelOptions = {}) {\n const defaultedCancelOptions = { revert: true, ...cancelOptions };\n const promises = notifyManager.batch(\n () => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions))\n );\n return Promise.all(promises).then(noop).catch(noop);\n }\n invalidateQueries(filters = {}, options = {}) {\n return notifyManager.batch(() => {\n this.#queryCache.findAll(filters).forEach((query) => {\n query.invalidate();\n });\n if (filters.refetchType === \"none\") {\n return Promise.resolve();\n }\n const refetchFilters = {\n ...filters,\n type: filters.refetchType ?? filters.type ?? \"active\"\n };\n return this.refetchQueries(refetchFilters, options);\n });\n }\n refetchQueries(filters = {}, options) {\n const fetchOptions = {\n ...options,\n cancelRefetch: options?.cancelRefetch ?? true\n };\n const promises = notifyManager.batch(\n () => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled()).map((query) => {\n let promise = query.fetch(void 0, fetchOptions);\n if (!fetchOptions.throwOnError) {\n promise = promise.catch(noop);\n }\n return query.state.fetchStatus === \"paused\" ? Promise.resolve() : promise;\n })\n );\n return Promise.all(promises).then(noop);\n }\n fetchQuery(options) {\n const defaultedOptions = this.defaultQueryOptions(options);\n if (defaultedOptions.retry === void 0) {\n defaultedOptions.retry = false;\n }\n const query = this.#queryCache.build(this, defaultedOptions);\n return query.isStaleByTime(\n resolveStaleTime(defaultedOptions.staleTime, query)\n ) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);\n }\n prefetchQuery(options) {\n return this.fetchQuery(options).then(noop).catch(noop);\n }\n fetchInfiniteQuery(options) {\n options.behavior = infiniteQueryBehavior(options.pages);\n return this.fetchQuery(options);\n }\n prefetchInfiniteQuery(options) {\n return this.fetchInfiniteQuery(options).then(noop).catch(noop);\n }\n ensureInfiniteQueryData(options) {\n options.behavior = infiniteQueryBehavior(options.pages);\n return this.ensureQueryData(options);\n }\n resumePausedMutations() {\n if (onlineManager.isOnline()) {\n return this.#mutationCache.resumePausedMutations();\n }\n return Promise.resolve();\n }\n getQueryCache() {\n return this.#queryCache;\n }\n getMutationCache() {\n return this.#mutationCache;\n }\n getDefaultOptions() {\n return this.#defaultOptions;\n }\n setDefaultOptions(options) {\n this.#defaultOptions = options;\n }\n setQueryDefaults(queryKey, options) {\n this.#queryDefaults.set(hashKey(queryKey), {\n queryKey,\n defaultOptions: options\n });\n }\n getQueryDefaults(queryKey) {\n const defaults = [...this.#queryDefaults.values()];\n let result = {};\n defaults.forEach((queryDefault) => {\n if (partialMatchKey(queryKey, queryDefault.queryKey)) {\n result = { ...result, ...queryDefault.defaultOptions };\n }\n });\n return result;\n }\n setMutationDefaults(mutationKey, options) {\n this.#mutationDefaults.set(hashKey(mutationKey), {\n mutationKey,\n defaultOptions: options\n });\n }\n getMutationDefaults(mutationKey) {\n const defaults = [...this.#mutationDefaults.values()];\n let result = {};\n defaults.forEach((queryDefault) => {\n if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {\n result = { ...result, ...queryDefault.defaultOptions };\n }\n });\n return result;\n }\n defaultQueryOptions(options) {\n if (options._defaulted) {\n return options;\n }\n const defaultedOptions = {\n ...this.#defaultOptions.queries,\n ...this.getQueryDefaults(options.queryKey),\n ...options,\n _defaulted: true\n };\n if (!defaultedOptions.queryHash) {\n defaultedOptions.queryHash = hashQueryKeyByOptions(\n defaultedOptions.queryKey,\n defaultedOptions\n );\n }\n if (defaultedOptions.refetchOnReconnect === void 0) {\n defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== \"always\";\n }\n if (defaultedOptions.throwOnError === void 0) {\n defaultedOptions.throwOnError = !!defaultedOptions.suspense;\n }\n if (!defaultedOptions.networkMode && defaultedOptions.persister) {\n defaultedOptions.networkMode = \"offlineFirst\";\n }\n if (defaultedOptions.enabled !== true && defaultedOptions.queryFn === skipToken) {\n defaultedOptions.enabled = false;\n }\n return defaultedOptions;\n }\n defaultMutationOptions(options) {\n if (options?._defaulted) {\n return options;\n }\n return {\n ...this.#defaultOptions.mutations,\n ...options?.mutationKey && this.getMutationDefaults(options.mutationKey),\n ...options,\n _defaulted: true\n };\n }\n clear() {\n this.#queryCache.clear();\n this.#mutationCache.clear();\n }\n};\nexport {\n QueryClient\n};\n//# sourceMappingURL=queryClient.js.map","// src/mutationObserver.ts\nimport { getDefaultState } from \"./mutation.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { hashKey, shallowEqualObjects } from \"./utils.js\";\nvar MutationObserver = class extends Subscribable {\n #client;\n #currentResult = void 0;\n #currentMutation;\n #mutateOptions;\n constructor(client, options) {\n super();\n this.#client = client;\n this.setOptions(options);\n this.bindMethods();\n this.#updateResult();\n }\n bindMethods() {\n this.mutate = this.mutate.bind(this);\n this.reset = this.reset.bind(this);\n }\n setOptions(options) {\n const prevOptions = this.options;\n this.options = this.#client.defaultMutationOptions(options);\n if (!shallowEqualObjects(this.options, prevOptions)) {\n this.#client.getMutationCache().notify({\n type: \"observerOptionsUpdated\",\n mutation: this.#currentMutation,\n observer: this\n });\n }\n if (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) {\n this.reset();\n } else if (this.#currentMutation?.state.status === \"pending\") {\n this.#currentMutation.setOptions(this.options);\n }\n }\n onUnsubscribe() {\n if (!this.hasListeners()) {\n this.#currentMutation?.removeObserver(this);\n }\n }\n onMutationUpdate(action) {\n this.#updateResult();\n this.#notify(action);\n }\n getCurrentResult() {\n return this.#currentResult;\n }\n reset() {\n this.#currentMutation?.removeObserver(this);\n this.#currentMutation = void 0;\n this.#updateResult();\n this.#notify();\n }\n mutate(variables, options) {\n this.#mutateOptions = options;\n this.#currentMutation?.removeObserver(this);\n this.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);\n this.#currentMutation.addObserver(this);\n return this.#currentMutation.execute(variables);\n }\n #updateResult() {\n const state = this.#currentMutation?.state ?? getDefaultState();\n this.#currentResult = {\n ...state,\n isPending: state.status === \"pending\",\n isSuccess: state.status === \"success\",\n isError: state.status === \"error\",\n isIdle: state.status === \"idle\",\n mutate: this.mutate,\n reset: this.reset\n };\n }\n #notify(action) {\n notifyManager.batch(() => {\n if (this.#mutateOptions && this.hasListeners()) {\n const variables = this.#currentResult.variables;\n const context = this.#currentResult.context;\n if (action?.type === \"success\") {\n this.#mutateOptions.onSuccess?.(action.data, variables, context);\n this.#mutateOptions.onSettled?.(action.data, null, variables, context);\n } else if (action?.type === \"error\") {\n this.#mutateOptions.onError?.(action.error, variables, context);\n this.#mutateOptions.onSettled?.(\n void 0,\n action.error,\n variables,\n context\n );\n }\n }\n this.listeners.forEach((listener) => {\n listener(this.#currentResult);\n });\n });\n }\n};\nexport {\n MutationObserver\n};\n//# sourceMappingURL=mutationObserver.js.map","import { disconnect, } from '../actions/disconnect.js';\nexport function disconnectMutationOptions(config) {\n return {\n mutationFn(variables) {\n return disconnect(config, variables);\n },\n mutationKey: ['disconnect'],\n };\n}\n//# sourceMappingURL=disconnect.js.map","\"use client\";\n\n// src/QueryClientProvider.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nvar QueryClientContext = React.createContext(\n void 0\n);\nvar useQueryClient = (queryClient) => {\n const client = React.useContext(QueryClientContext);\n if (queryClient) {\n return queryClient;\n }\n if (!client) {\n throw new Error(\"No QueryClient set, use QueryClientProvider to set one\");\n }\n return client;\n};\nvar QueryClientProvider = ({\n client,\n children\n}) => {\n React.useEffect(() => {\n client.mount();\n return () => {\n client.unmount();\n };\n }, [client]);\n return /* @__PURE__ */ jsx(QueryClientContext.Provider, { value: client, children });\n};\nexport {\n QueryClientContext,\n QueryClientProvider,\n useQueryClient\n};\n//# sourceMappingURL=QueryClientProvider.js.map","// src/utils.ts\nfunction shouldThrowError(throwError, params) {\n if (typeof throwError === \"function\") {\n return throwError(...params);\n }\n return !!throwError;\n}\nfunction noop() {\n}\nexport {\n noop,\n shouldThrowError\n};\n//# sourceMappingURL=utils.js.map","\"use client\";\n\n// src/useMutation.ts\nimport * as React from \"react\";\nimport { MutationObserver, notifyManager } from \"@tanstack/query-core\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport { noop, shouldThrowError } from \"./utils.js\";\nfunction useMutation(options, queryClient) {\n const client = useQueryClient(queryClient);\n const [observer] = React.useState(\n () => new MutationObserver(\n client,\n options\n )\n );\n React.useEffect(() => {\n observer.setOptions(options);\n }, [observer, options]);\n const result = React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)),\n [observer]\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult()\n );\n const mutate = React.useCallback(\n (variables, mutateOptions) => {\n observer.mutate(variables, mutateOptions).catch(noop);\n },\n [observer]\n );\n if (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) {\n throw result.error;\n }\n return { ...result, mutate, mutateAsync: result.mutate };\n}\nexport {\n useMutation\n};\n//# sourceMappingURL=useMutation.js.map","'use client';\nimport { getChainId, watchChainId, } from '@wagmi/core';\nimport { useSyncExternalStore } from 'react';\nimport { useConfig } from './useConfig.js';\n/** https://wagmi.sh/react/api/hooks/useChainId */\nexport function useChainId(parameters = {}) {\n const config = useConfig(parameters);\n return useSyncExternalStore((onChange) => watchChainId(config, { onChange }), () => getChainId(config), () => getChainId(config));\n}\n//# sourceMappingURL=useChainId.js.map","'use client';\nimport { getConnections, watchConnections, } from '@wagmi/core';\nimport { useSyncExternalStore } from 'react';\nimport { useConfig } from './useConfig.js';\n/** https://wagmi.sh/react/api/hooks/useConnections */\nexport function useConnections(parameters = {}) {\n const config = useConfig(parameters);\n return useSyncExternalStore((onChange) => watchConnections(config, { onChange }), () => getConnections(config), () => getConnections(config));\n}\n//# sourceMappingURL=useConnections.js.map","'use client';\nimport { useMutation } from '@tanstack/react-query';\nimport { disconnectMutationOptions, } from '@wagmi/core/query';\nimport { useConfig } from './useConfig.js';\nimport { useConnections } from './useConnections.js';\n/** https://wagmi.sh/react/api/hooks/useDisconnect */\nexport function useDisconnect(parameters = {}) {\n const { mutation } = parameters;\n const config = useConfig(parameters);\n const mutationOptions = disconnectMutationOptions(config);\n const { mutate, mutateAsync, ...result } = useMutation({\n ...mutation,\n ...mutationOptions,\n });\n return {\n ...result,\n connectors: useConnections({ config }).map((connection) => connection.connector),\n disconnect: mutate,\n disconnectAsync: mutateAsync,\n };\n}\n//# sourceMappingURL=useDisconnect.js.map"],"file":"assets/wagmi-vendor-BLjn5WyF.js"}