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ooks/useSignMessage.js","webpack://_N_E/./node_modules/viem/_esm/actions/wallet/addChain.js","webpack://_N_E/./node_modules/viem/_esm/utils/abi/encodeDeployData.js","webpack://_N_E/./node_modules/viem/_esm/actions/wallet/deployContract.js","webpack://_N_E/./node_modules/viem/_esm/actions/wallet/getAddresses.js","webpack://_N_E/./node_modules/viem/_esm/actions/wallet/getPermissions.js","webpack://_N_E/./node_modules/viem/_esm/actions/wallet/requestAddresses.js","webpack://_N_E/./node_modules/viem/_esm/actions/wallet/requestPermissions.js","webpack://_N_E/./node_modules/viem/_esm/actions/wallet/signTransaction.js","webpack://_N_E/./node_modules/viem/_esm/utils/regex.js","webpack://_N_E/./node_modules/viem/_esm/utils/typedData.js","webpack://_N_E/./node_modules/viem/_esm/actions/wallet/signTypedData.js","webpack://_N_E/./node_modules/viem/_esm/actions/wallet/switchChain.js","webpack://_N_E/./node_modules/viem/_esm/actions/wallet/watchAsset.js","webpack://_N_E/./node_modules/viem/_esm/clients/decorators/wallet.js","webpack://_N_E/./node_modules/@wagmi/core/dist/esm/actions/getWalletClient.js","webpack://_N_E/./node_modules/@wagmi/core/dist/esm/query/getWalletClient.js","webpack://_N_E/./node_modules/wagmi/dist/esm/hooks/useWalletClient.js","webpack://_N_E/"],"sourcesContent":["import { signMessage, } from '../actions/signMessage.js';\nimport {} from '../createConfig.js';\nimport {} from '../types/utils.js';\nimport {} from './types.js';\nexport function signMessageMutationOptions(config) {\n return {\n mutationFn(variables) {\n return signMessage(config, variables);\n },\n mutationKey: ['signMessage'],\n };\n}\n//# sourceMappingURL=signMessage.js.map","'use client';\nimport { useMutation } from '@tanstack/react-query';\nimport {} from '@wagmi/core';\nimport { signMessageMutationOptions, } from '@wagmi/core/query';\nimport { useConfig } from './useConfig.js';\n/** https://wagmi.sh/react/api/hooks/useSignMessage */\nexport function useSignMessage(parameters = {}) {\n const { mutation } = parameters;\n const config = useConfig(parameters);\n const mutationOptions = signMessageMutationOptions(config);\n const { mutate, mutateAsync, ...result } = useMutation({\n ...mutation,\n ...mutationOptions,\n });\n return {\n ...result,\n signMessage: mutate,\n signMessageAsync: mutateAsync,\n };\n}\n//# sourceMappingURL=useSignMessage.js.map","import { numberToHex, } from '../../utils/encoding/toHex.js';\n/**\n * Adds an EVM chain to the wallet.\n *\n * - Docs: https://viem.sh/docs/actions/wallet/addChain\n * - JSON-RPC Methods: [`eth_addEthereumChain`](https://eips.ethereum.org/EIPS/eip-3085)\n *\n * @param client - Client to use\n * @param parameters - {@link AddChainParameters}\n *\n * @example\n * import { createWalletClient, custom } from 'viem'\n * import { optimism } from 'viem/chains'\n * import { addChain } from 'viem/wallet'\n *\n * const client = createWalletClient({\n * transport: custom(window.ethereum),\n * })\n * await addChain(client, { chain: optimism })\n */\nexport async function addChain(client, { chain }) {\n const { id, name, nativeCurrency, rpcUrls, blockExplorers } = chain;\n await client.request({\n method: 'wallet_addEthereumChain',\n params: [\n {\n chainId: numberToHex(id),\n chainName: name,\n nativeCurrency,\n rpcUrls: rpcUrls.default.http,\n blockExplorerUrls: blockExplorers\n ? Object.values(blockExplorers).map(({ url }) => url)\n : undefined,\n },\n ],\n }, { retryCount: 0 });\n}\n//# sourceMappingURL=addChain.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 { encodeDeployData } from '../../utils/abi/encodeDeployData.js';\nimport { sendTransaction, } from './sendTransaction.js';\n/**\n * Deploys a contract to the network, given bytecode and constructor arguments.\n *\n * - Docs: https://viem.sh/docs/contract/deployContract\n * - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/deploying-contracts\n *\n * @param client - Client to use\n * @param parameters - {@link DeployContractParameters}\n * @returns The [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. {@link DeployContractReturnType}\n *\n * @example\n * import { createWalletClient, http } from 'viem'\n * import { privateKeyToAccount } from 'viem/accounts'\n * import { mainnet } from 'viem/chains'\n * import { deployContract } from 'viem/contract'\n *\n * const client = createWalletClient({\n * account: privateKeyToAccount('0x…'),\n * chain: mainnet,\n * transport: http(),\n * })\n * const hash = await deployContract(client, {\n * abi: [],\n * account: '0x…,\n * bytecode: '0x608060405260405161083e38038061083e833981016040819052610...',\n * })\n */\nexport function deployContract(walletClient, parameters) {\n const { abi, args, bytecode, ...request } = parameters;\n const calldata = encodeDeployData({ abi, args, bytecode });\n return sendTransaction(walletClient, {\n ...request,\n data: calldata,\n });\n}\n//# sourceMappingURL=deployContract.js.map","import { checksumAddress, } from '../../utils/address/getAddress.js';\n/**\n * Returns a list of account addresses owned by the wallet or client.\n *\n * - Docs: https://viem.sh/docs/actions/wallet/getAddresses\n * - JSON-RPC Methods: [`eth_accounts`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_accounts)\n *\n * @param client - Client to use\n * @returns List of account addresses owned by the wallet or client. {@link GetAddressesReturnType}\n *\n * @example\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { getAddresses } from 'viem/wallet'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n * const accounts = await getAddresses(client)\n */\nexport async function getAddresses(client) {\n if (client.account?.type === 'local')\n return [client.account.address];\n const addresses = await client.request({ method: 'eth_accounts' });\n return addresses.map((address) => checksumAddress(address));\n}\n//# sourceMappingURL=getAddresses.js.map","/**\n * Gets the wallets current permissions.\n *\n * - Docs: https://viem.sh/docs/actions/wallet/getPermissions\n * - JSON-RPC Methods: [`wallet_getPermissions`](https://eips.ethereum.org/EIPS/eip-2255)\n *\n * @param client - Client to use\n * @returns The wallet permissions. {@link GetPermissionsReturnType}\n *\n * @example\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { getPermissions } from 'viem/wallet'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n * const permissions = await getPermissions(client)\n */\nexport async function getPermissions(client) {\n const permissions = await client.request({ method: 'wallet_getPermissions' });\n return permissions;\n}\n//# sourceMappingURL=getPermissions.js.map","import { getAddress } from '../../utils/address/getAddress.js';\n/**\n * Requests a list of accounts managed by a wallet.\n *\n * - Docs: https://viem.sh/docs/actions/wallet/requestAddresses\n * - JSON-RPC Methods: [`eth_requestAccounts`](https://eips.ethereum.org/EIPS/eip-1102)\n *\n * Sends a request to the wallet, asking for permission to access the user's accounts. After the user accepts the request, it will return a list of accounts (addresses).\n *\n * This API can be useful for dapps that need to access the user's accounts in order to execute transactions or interact with smart contracts.\n *\n * @param client - Client to use\n * @returns List of accounts managed by a wallet {@link RequestAddressesReturnType}\n *\n * @example\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { requestAddresses } from 'viem/wallet'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n * const accounts = await requestAddresses(client)\n */\nexport async function requestAddresses(client) {\n const addresses = await client.request({ method: 'eth_requestAccounts' }, { retryCount: 0 });\n return addresses.map((address) => getAddress(address));\n}\n//# sourceMappingURL=requestAddresses.js.map","/**\n * Requests permissions for a wallet.\n *\n * - Docs: https://viem.sh/docs/actions/wallet/requestPermissions\n * - JSON-RPC Methods: [`wallet_requestPermissions`](https://eips.ethereum.org/EIPS/eip-2255)\n *\n * @param client - Client to use\n * @param parameters - {@link RequestPermissionsParameters}\n * @returns The wallet permissions. {@link RequestPermissionsReturnType}\n *\n * @example\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { requestPermissions } from 'viem/wallet'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n * const permissions = await requestPermissions(client, {\n * eth_accounts: {}\n * })\n */\nexport async function requestPermissions(client, permissions) {\n return client.request({\n method: 'wallet_requestPermissions',\n params: [permissions],\n }, { retryCount: 0 });\n}\n//# sourceMappingURL=requestPermissions.js.map","import { parseAccount, } from '../../accounts/utils/parseAccount.js';\nimport { AccountNotFoundError } from '../../errors/account.js';\nimport {} from '../../types/rpc.js';\nimport { assertCurrentChain, } from '../../utils/chain/assertCurrentChain.js';\nimport { numberToHex } from '../../utils/encoding/toHex.js';\nimport { formatTransactionRequest, } from '../../utils/formatters/transactionRequest.js';\nimport { getAction } from '../../utils/getAction.js';\nimport { assertRequest, } from '../../utils/transaction/assertRequest.js';\nimport { getChainId } from '../public/getChainId.js';\n/**\n * Signs a transaction.\n *\n * - Docs: https://viem.sh/docs/actions/wallet/signTransaction\n * - JSON-RPC Methods:\n * - JSON-RPC Accounts: [`eth_signTransaction`](https://ethereum.github.io/execution-apis/api-documentation/)\n * - Local Accounts: Signs locally. No JSON-RPC request.\n *\n * @param args - {@link SignTransactionParameters}\n * @returns The signed serialized tranasction. {@link SignTransactionReturnType}\n *\n * @example\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { signTransaction } from 'viem/actions'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n * const signature = await signTransaction(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 { signTransaction } from 'viem/actions'\n *\n * const client = createWalletClient({\n * account: privateKeyToAccount('0x…'),\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n * const signature = await signTransaction(client, {\n * to: '0x0000000000000000000000000000000000000000',\n * value: 1n,\n * })\n */\nexport async function signTransaction(client, parameters) {\n const { account: account_ = client.account, chain = client.chain, ...transaction } = parameters;\n if (!account_)\n throw new AccountNotFoundError({\n docsPath: '/docs/actions/wallet/signTransaction',\n });\n const account = parseAccount(account_);\n assertRequest({\n account,\n ...parameters,\n });\n const chainId = await getAction(client, getChainId, 'getChainId')({});\n if (chain !== null)\n assertCurrentChain({\n currentChainId: chainId,\n chain,\n });\n const formatters = chain?.formatters || client.chain?.formatters;\n const format = formatters?.transactionRequest?.format || formatTransactionRequest;\n if (account.type === 'local') {\n return account.signTransaction({\n ...transaction,\n chainId,\n }, { serializer: client.chain?.serializers?.transaction });\n }\n return await client.request({\n method: 'eth_signTransaction',\n params: [\n {\n ...format(transaction),\n chainId: numberToHex(chainId),\n from: account.address,\n },\n ],\n }, { retryCount: 0 });\n}\n//# sourceMappingURL=signTransaction.js.map","export const arrayRegex = /^(.*)\\[([0-9]*)\\]$/;\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)?$/;\n//# sourceMappingURL=regex.js.map","import { BytesSizeMismatchError } from '../errors/abi.js';\nimport { InvalidAddressError } from '../errors/address.js';\nimport { isAddress } from './address/isAddress.js';\nimport { size } from './data/size.js';\nimport { numberToHex } from './encoding/toHex.js';\nimport { bytesRegex, integerRegex } from './regex.js';\nimport { hashDomain, } from './signature/hashTypedData.js';\nexport function validateTypedData(parameters) {\n const { domain, message, primaryType, types } = parameters;\n const validateData = (struct, data) => {\n for (const param of struct) {\n const { name, type } = param;\n const value = data[name];\n const integerMatch = type.match(integerRegex);\n if (integerMatch &&\n (typeof value === 'number' || typeof value === 'bigint')) {\n const [_type, base, size_] = integerMatch;\n // If number cannot be cast to a sized hex value, it is out of range\n // and will throw.\n numberToHex(value, {\n signed: base === 'int',\n size: parseInt(size_) / 8,\n });\n }\n if (type === 'address' && typeof value === 'string' && !isAddress(value))\n throw new InvalidAddressError({ address: value });\n const bytesMatch = type.match(bytesRegex);\n if (bytesMatch) {\n const [_type, size_] = bytesMatch;\n if (size_ && size(value) !== parseInt(size_))\n throw new BytesSizeMismatchError({\n expectedSize: parseInt(size_),\n givenSize: size(value),\n });\n }\n const struct = types[type];\n if (struct)\n validateData(struct, value);\n }\n };\n // Validate domain types.\n if (types.EIP712Domain && domain)\n validateData(types.EIP712Domain, domain);\n if (primaryType !== 'EIP712Domain') {\n // Validate message types.\n const type = types[primaryType];\n validateData(type, message);\n }\n}\nexport function getTypesForEIP712Domain({ domain, }) {\n return [\n typeof domain?.name === 'string' && { name: 'name', type: 'string' },\n domain?.version && { name: 'version', type: 'string' },\n typeof domain?.chainId === 'number' && {\n name: 'chainId',\n type: 'uint256',\n },\n domain?.verifyingContract && {\n name: 'verifyingContract',\n type: 'address',\n },\n domain?.salt && { name: 'salt', type: 'bytes32' },\n ].filter(Boolean);\n}\nexport function domainSeparator({ domain }) {\n return hashDomain({\n domain,\n types: {\n EIP712Domain: getTypesForEIP712Domain({ domain }),\n },\n });\n}\n//# sourceMappingURL=typedData.js.map","import { parseAccount, } from '../../accounts/utils/parseAccount.js';\nimport { AccountNotFoundError, } from '../../errors/account.js';\nimport { isHex } from '../../utils/data/isHex.js';\nimport { stringify } from '../../utils/stringify.js';\nimport { getTypesForEIP712Domain, validateTypedData, } from '../../utils/typedData.js';\n/**\n * Signs typed data and calculates an Ethereum-specific signature in [https://eips.ethereum.org/EIPS/eip-712](https://eips.ethereum.org/EIPS/eip-712): `sign(keccak256(\"\\x19\\x01\" ‖ domainSeparator ‖ hashStruct(message)))`\n *\n * - Docs: https://viem.sh/docs/actions/wallet/signTypedData\n * - JSON-RPC Methods:\n * - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data#signtypeddata-v4)\n * - Local Accounts: Signs locally. No JSON-RPC request.\n *\n * @param client - Client to use\n * @param parameters - {@link SignTypedDataParameters}\n * @returns The signed data. {@link SignTypedDataReturnType}\n *\n * @example\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { signTypedData } from 'viem/wallet'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n * const signature = await signTypedData(client, {\n * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',\n * domain: {\n * name: 'Ether Mail',\n * version: '1',\n * chainId: 1,\n * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',\n * },\n * types: {\n * Person: [\n * { name: 'name', type: 'string' },\n * { name: 'wallet', type: 'address' },\n * ],\n * Mail: [\n * { name: 'from', type: 'Person' },\n * { name: 'to', type: 'Person' },\n * { name: 'contents', type: 'string' },\n * ],\n * },\n * primaryType: 'Mail',\n * message: {\n * from: {\n * name: 'Cow',\n * wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',\n * },\n * to: {\n * name: 'Bob',\n * wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',\n * },\n * contents: 'Hello, Bob!',\n * },\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 { signTypedData } from 'viem/wallet'\n *\n * const client = createWalletClient({\n * account: privateKeyToAccount('0x…'),\n * chain: mainnet,\n * transport: http(),\n * })\n * const signature = await signTypedData(client, {\n * domain: {\n * name: 'Ether Mail',\n * version: '1',\n * chainId: 1,\n * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',\n * },\n * types: {\n * Person: [\n * { name: 'name', type: 'string' },\n * { name: 'wallet', type: 'address' },\n * ],\n * Mail: [\n * { name: 'from', type: 'Person' },\n * { name: 'to', type: 'Person' },\n * { name: 'contents', type: 'string' },\n * ],\n * },\n * primaryType: 'Mail',\n * message: {\n * from: {\n * name: 'Cow',\n * wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',\n * },\n * to: {\n * name: 'Bob',\n * wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',\n * },\n * contents: 'Hello, Bob!',\n * },\n * })\n */\nexport async function signTypedData(client, parameters) {\n const { account: account_ = client.account, domain, message, primaryType, } = parameters;\n if (!account_)\n throw new AccountNotFoundError({\n docsPath: '/docs/actions/wallet/signTypedData',\n });\n const account = parseAccount(account_);\n const types = {\n EIP712Domain: getTypesForEIP712Domain({ domain }),\n ...parameters.types,\n };\n // Need to do a runtime validation check on addresses, byte ranges, integer ranges, etc\n // as we can't statically check this with TypeScript.\n validateTypedData({ domain, message, primaryType, types });\n if (account.type === 'local')\n return account.signTypedData({ domain, message, primaryType, types });\n const typedData = stringify({ domain: domain ?? {}, message, primaryType, types }, (_, value) => (isHex(value) ? value.toLowerCase() : value));\n return client.request({\n method: 'eth_signTypedData_v4',\n params: [account.address, typedData],\n }, { retryCount: 0 });\n}\n//# sourceMappingURL=signTypedData.js.map","import { numberToHex, } from '../../utils/encoding/toHex.js';\n/**\n * Switch the target chain in a wallet.\n *\n * - Docs: https://viem.sh/docs/actions/wallet/switchChain\n * - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-3326)\n *\n * @param client - Client to use\n * @param parameters - {@link SwitchChainParameters}\n *\n * @example\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet, optimism } from 'viem/chains'\n * import { switchChain } from 'viem/wallet'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n * await switchChain(client, { id: optimism.id })\n */\nexport async function switchChain(client, { id }) {\n await client.request({\n method: 'wallet_switchEthereumChain',\n params: [\n {\n chainId: numberToHex(id),\n },\n ],\n }, { retryCount: 0 });\n}\n//# sourceMappingURL=switchChain.js.map","/**\n * Adds an EVM chain to the wallet.\n *\n * - Docs: https://viem.sh/docs/actions/wallet/watchAsset\n * - JSON-RPC Methods: [`eth_switchEthereumChain`](https://eips.ethereum.org/EIPS/eip-747)\n *\n * @param client - Client to use\n * @param parameters - {@link WatchAssetParameters}\n * @returns Boolean indicating if the token was successfully added. {@link WatchAssetReturnType}\n *\n * @example\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n * import { watchAsset } from 'viem/wallet'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum),\n * })\n * const success = await watchAsset(client, {\n * type: 'ERC20',\n * options: {\n * address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',\n * decimals: 18,\n * symbol: 'WETH',\n * },\n * })\n */\nexport async function watchAsset(client, params) {\n const added = await client.request({\n method: 'wallet_watchAsset',\n params,\n }, { retryCount: 0 });\n return added;\n}\n//# sourceMappingURL=watchAsset.js.map","import { getChainId, } from '../../actions/public/getChainId.js';\nimport { addChain, } from '../../actions/wallet/addChain.js';\nimport { deployContract, } from '../../actions/wallet/deployContract.js';\nimport { getAddresses, } from '../../actions/wallet/getAddresses.js';\nimport { getPermissions, } from '../../actions/wallet/getPermissions.js';\nimport { prepareTransactionRequest, } from '../../actions/wallet/prepareTransactionRequest.js';\nimport { requestAddresses, } from '../../actions/wallet/requestAddresses.js';\nimport { requestPermissions, } from '../../actions/wallet/requestPermissions.js';\nimport { sendRawTransaction, } from '../../actions/wallet/sendRawTransaction.js';\nimport { sendTransaction, } from '../../actions/wallet/sendTransaction.js';\nimport { signMessage, } from '../../actions/wallet/signMessage.js';\nimport { signTransaction, } from '../../actions/wallet/signTransaction.js';\nimport { signTypedData, } from '../../actions/wallet/signTypedData.js';\nimport { switchChain, } from '../../actions/wallet/switchChain.js';\nimport { watchAsset, } from '../../actions/wallet/watchAsset.js';\nimport { writeContract, } from '../../actions/wallet/writeContract.js';\nimport {} from '../../types/contract.js';\nexport function walletActions(client) {\n return {\n addChain: (args) => addChain(client, args),\n deployContract: (args) => deployContract(client, args),\n getAddresses: () => getAddresses(client),\n getChainId: () => getChainId(client),\n getPermissions: () => getPermissions(client),\n prepareTransactionRequest: (args) => prepareTransactionRequest(client, args),\n requestAddresses: () => requestAddresses(client),\n requestPermissions: (args) => requestPermissions(client, args),\n sendRawTransaction: (args) => sendRawTransaction(client, args),\n sendTransaction: (args) => sendTransaction(client, args),\n signMessage: (args) => signMessage(client, args),\n signTransaction: (args) => signTransaction(client, args),\n signTypedData: (args) => signTypedData(client, args),\n switchChain: (args) => switchChain(client, args),\n watchAsset: (args) => watchAsset(client, args),\n writeContract: (args) => writeContract(client, args),\n };\n}\n//# sourceMappingURL=wallet.js.map","import { walletActions } from 'viem';\nimport {} from '../createConfig.js';\nimport {} from '../types/utils.js';\nimport { getConnectorClient, } from './getConnectorClient.js';\nexport async function getWalletClient(config, parameters = {}) {\n const client = await getConnectorClient(config, parameters);\n client.extend(walletActions);\n // @ts-ignore\n return client.extend(walletActions);\n}\n//# sourceMappingURL=getWalletClient.js.map","import {} from '@tanstack/query-core';\nimport { getWalletClient, } from '../actions/getWalletClient.js';\nimport {} from '../createConfig.js';\nimport { filterQueryOptions } from './utils.js';\nexport function getWalletClientQueryOptions(config, options = {}) {\n return {\n gcTime: 0,\n async queryFn({ queryKey }) {\n const { connector } = options;\n const { connectorUid: _, scopeKey: _s, ...parameters } = queryKey[1];\n return getWalletClient(config, { ...parameters, connector });\n },\n queryKey: getWalletClientQueryKey(options),\n };\n}\nexport function getWalletClientQueryKey(options = {}) {\n const { connector, ...parameters } = options;\n return [\n 'walletClient',\n { ...filterQueryOptions(parameters), connectorUid: connector?.uid },\n ];\n}\n//# sourceMappingURL=getWalletClient.js.map","'use client';\n// Almost identical implementation to `useConnectorClient` (except for return type)\n// Should update both in tandem\nimport { useQueryClient } from '@tanstack/react-query';\nimport {} from '@wagmi/core/internal';\nimport { getWalletClientQueryOptions, } from '@wagmi/core/query';\nimport { useEffect, useRef } from 'react';\nimport { useQuery, } from '../utils/query.js';\nimport { useAccount } from './useAccount.js';\nimport { useChainId } from './useChainId.js';\nimport { useConfig } from './useConfig.js';\n/** https://wagmi.sh/react/api/hooks/useWalletClient */\nexport function useWalletClient(parameters = {}) {\n const { query = {}, ...rest } = parameters;\n const config = useConfig(rest);\n const queryClient = useQueryClient();\n const { address, connector, status } = useAccount({ config });\n const chainId = useChainId({ config });\n const { queryKey, ...options } = getWalletClientQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n connector: parameters.connector ?? connector,\n });\n const enabled = Boolean(status !== 'disconnected' && (query.enabled ?? true));\n const addressRef = useRef(address);\n // biome-ignore lint/nursery/useExhaustiveDependencies: `queryKey` not required\n useEffect(() => {\n const previousAddress = addressRef.current;\n if (!address && previousAddress) {\n // remove when account is disconnected\n queryClient.removeQueries({ queryKey });\n addressRef.current = undefined;\n }\n else if (address !== previousAddress) {\n // invalidate when address changes\n queryClient.invalidateQueries({ queryKey });\n addressRef.current = address;\n }\n }, [address, queryClient]);\n return useQuery({\n ...query,\n ...options,\n queryKey,\n enabled,\n staleTime: Infinity,\n });\n}\n//# sourceMappingURL=useWalletClient.js.map"],"names":["useSignMessage","parameters","config","mutation","mutationOptions","useConfig","Z","mutationFn","signMessage","l","variables","mutationKey","mutate","mutateAsync","result","useMutation","D","signMessageAsync","addChain","client","chain","id","name","nativeCurrency","rpcUrls","blockExplorers","request","method","params","chainId","toHex","eC","chainName","default","http","blockExplorerUrls","Object","values","map","url","undefined","retryCount","docsPath","getAddresses","account","type","address","addresses","getAddress","x","getPermissions","requestAddresses","K","requestPermissions","permissions","signTransaction","account_","transaction","errors_account","o","parseAccount","T","assertRequest","F","getAction","s","getChainId","L","assertCurrentChain","q","currentChainId","formatters","format","transactionRequest","tG","serializer","serializers","from","bytesRegex","integerRegex","signTypedData","domain","message","primaryType","types","EIP712Domain","getTypesForEIP712Domain","version","verifyingContract","salt","filter","Boolean","validateTypedData","validateData","struct","data","param","value","integerMatch","match","_type","base","size_","signed","size","parseInt","isAddress","U","b","bytesMatch","d","errors_abi","KY","expectedSize","givenSize","typedData","stringify","P","_","isHex","v","toLowerCase","switchChain","watchAsset","walletActions","args","deployContract","walletClient","abi","bytecode","calldata","encodeDeployData","length","description","find","fM","inputs","cO","encodeAbiParameters","E","concat","SM","sendTransaction","prepareTransactionRequest","sendRawTransaction","p","writeContract","n","getWalletClient","getConnectorClient","e","extend","useWalletClient","query","rest","queryClient","QueryClientProvider","NL","connector","status","useAccount","m","useChainId","queryKey","options","getWalletClientQueryOptions","gcTime","queryFn","connectorUid","scopeKey","_s","getWalletClientQueryKey","utils","O","uid","enabled","addressRef","react","useRef","useEffect","previousAddress","current","removeQueries","invalidateQueries","utils_query","aM","staleTime","Infinity"],"sourceRoot":""}