From d732295c4fbbe56222553f2a3918bab1c7d0a032 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 23 Oct 2023 20:52:55 +0300 Subject: [PATCH] fix: impersonated connector --- dist/index.cjs | 4 ++-- dist/index.cjs.map | 2 +- dist/index.d.cts | 2 +- dist/index.d.ts | 2 +- dist/index.js | 4 ++-- dist/index.js.map | 2 +- package.json | 2 +- src/web3/store/walletSlice.ts | 8 +++----- 8 files changed, 12 insertions(+), 14 deletions(-) diff --git a/dist/index.cjs b/dist/index.cjs index ca6f130..c2fc523 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -2775,7 +2775,7 @@ function createWalletSlice({ } }, isActiveWalletSetting: false, - connectWallet: async (walletType) => { + connectWallet: async (walletType, chainId) => { clearWalletLinkLocalStorage(); clearWalletConnectV2LocalStorage(); if (get().activeWallet?.walletType !== walletType) { @@ -2790,7 +2790,7 @@ function createWalletSlice({ if (connector) { if (connector instanceof ImpersonatedConnector) { connector.setAccountAddress(get()._impersonatedAddress); - await connect({ connector }); + await connect({ connector, chainId }); } else { await connect({ connector }); } diff --git a/dist/index.cjs.map b/dist/index.cjs.map index 08d4806..9c4cfae 100644 --- a/dist/index.cjs.map +++ b/dist/index.cjs.map @@ -1 +1 @@ -{"version":3,"sources":["../node_modules/eventemitter3/index.js","../src/index.tsx","../src/hooks/useLastTxLocalStatus.tsx","../src/web3/adapters/GelatoAdapter.ts","../src/utils/localStorage.ts","../src/web3/store/transactionsSelectors.ts","../src/utils/chainInfoHelpers.ts","../src/utils/constants.ts","../src/utils/wallets/wallets/alphawallet.ts","../src/utils/wallets/wallets/atoken.ts","../src/utils/wallets/wallets/binance.ts","../src/utils/wallets/wallets/bitkeep.ts","../src/utils/wallets/wallets/bitpie.ts","../src/utils/wallets/wallets/bitski.ts","../src/utils/wallets/wallets/blockwallet.ts","../src/utils/wallets/wallets/brave.ts","../src/utils/wallets/wallets/coinbase.ts","../src/utils/wallets/wallets/core.ts","../src/utils/wallets/wallets/dcent.ts","../src/utils/wallets/wallets/defiwallet.ts","../src/utils/wallets/wallets/enkrypt.ts","../src/utils/wallets/wallets/exodus.ts","../src/utils/wallets/wallets/frame.ts","../src/utils/wallets/wallets/frontier.ts","../src/utils/wallets/wallets/gamestop.ts","../src/utils/wallets/wallets/huobiwallet.ts","../src/utils/wallets/wallets/hyperpay.ts","../src/utils/wallets/wallets/imtoken.ts","../src/utils/wallets/wallets/liquality.ts","../src/utils/wallets/wallets/mathwallet.ts","../src/utils/wallets/wallets/meetone.ts","../src/utils/wallets/wallets/metamask.ts","../src/utils/wallets/wallets/mykey.ts","../src/utils/wallets/wallets/okxwallet.ts","../src/utils/wallets/wallets/oneInch.ts","../src/utils/wallets/wallets/opera.ts","../src/utils/wallets/wallets/ownbit.ts","../src/utils/wallets/wallets/phantom.ts","../src/utils/wallets/wallets/rabby.ts","../src/utils/wallets/wallets/rainbow.ts","../src/utils/wallets/wallets/safepal.ts","../src/utils/wallets/wallets/sequence.ts","../src/utils/wallets/wallets/status.ts","../src/utils/wallets/wallets/tallywallet.ts","../src/utils/wallets/wallets/tokenary.ts","../src/utils/wallets/wallets/tokenpocket.ts","../src/utils/wallets/wallets/tp.ts","../src/utils/wallets/wallets/trust.ts","../src/utils/wallets/wallets/walletio.ts","../src/utils/wallets/wallets/xdefi.ts","../src/utils/wallets/wallets/zeal.ts","../src/utils/wallets/wallets/zerion.ts","../src/utils/wallets/wallets.ts","../src/utils/wallets/wallets/defaultWallet.ts","../src/utils/wallets/getBrowserWalletLabelAndIcon.ts","../src/web3/connectors/index.ts","../node_modules/@wagmi/connectors/dist/chunk-OQILYQDO.js","../node_modules/@wagmi/connectors/dist/chunk-W65LBPLT.js","../node_modules/@wagmi/connectors/dist/mock/index.js","../node_modules/@wagmi/connectors/dist/chunk-UGBGYVBH.js","../node_modules/@wagmi/connectors/dist/chunk-2UFLHRLT.js","../node_modules/@wagmi/core/dist/chunk-MQXBDTVK.js","../node_modules/@wagmi/core/dist/chunk-TSH6VVF4.js","../src/web3/connectors/ImpersonatedConnector.ts","../src/web3/providers/WagmiProvider.tsx","../src/web3/store/transactionsSlice.ts","../src/web3/adapters/EthereumAdapter.ts","../src/web3/adapters/GnosisAdapter.ts","../src/web3/store/walletSlice.ts"],"sourcesContent":["'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","export * from './hooks/useLastTxLocalStatus';\nexport * from './types/store';\nexport * from './utils/chainInfoHelpers';\nexport * from './utils/constants';\nexport * from './utils/localStorage';\nexport * from './utils/wallets/getBrowserWalletLabelAndIcon';\nexport * from './web3/connectors/index';\nexport * from './web3/providers/WagmiProvider';\nexport * from './web3/store/transactionsSelectors';\nexport * from './web3/store/transactionsSlice';\nexport * from './web3/store/walletSlice';\n","import { useEffect, useState } from 'react';\n\nimport { isGelatoBaseTx } from '../web3/adapters/GelatoAdapter';\nimport { selectLastTxByTypeAndPayload } from '../web3/store/transactionsSelectors';\nimport { BaseTx, ITransactionsState } from '../web3/store/transactionsSlice';\n\ninterface LastTxStatusesParams {\n state: ITransactionsState;\n activeAddress: string;\n type: T['type'];\n payload: T['payload'];\n}\n\ntype ExecuteTxWithLocalStatusesParams = {\n errorMessage: string;\n callbackFunction: () => Promise;\n};\n\nexport const useLastTxLocalStatus = ({\n state,\n activeAddress,\n type,\n payload,\n}: LastTxStatusesParams) => {\n const tx = selectLastTxByTypeAndPayload(state, activeAddress, type, payload);\n\n const [fullTxErrorMessage, setFullTxErrorMessage] = useState(\n '',\n );\n const [error, setError] = useState('');\n const [loading, setLoading] = useState(false);\n const [isTxStart, setIsTxStart] = useState(false);\n\n const txHash = tx && tx.hash;\n const txPending = tx && tx.pending;\n const isError =\n tx && isGelatoBaseTx(tx)\n ? !tx.pending && (tx.status !== 1 || !!error)\n : (tx && !tx.pending && tx.status !== 1) || !!error;\n const txSuccess = tx && tx.status === 1 && !isError;\n const txChainId = tx && tx.chainId;\n const txWalletType = tx && tx.walletType;\n\n useEffect(() => {\n return () => {\n setFullTxErrorMessage('');\n setError('');\n };\n }, []);\n\n useEffect(() => {\n if (txPending || isError) {\n setIsTxStart(true);\n }\n }, [txPending, isError]);\n\n useEffect(() => {\n if (tx?.errorMessage) {\n setError(tx.errorMessage);\n }\n }, [tx?.errorMessage]);\n\n async function executeTxWithLocalStatuses({\n errorMessage,\n callbackFunction,\n }: ExecuteTxWithLocalStatusesParams) {\n setError('');\n setLoading(true);\n try {\n await callbackFunction();\n } catch (e) {\n if (e instanceof Error) {\n console.error('TX error: ', e);\n setFullTxErrorMessage(!!e?.message ? e.message : e);\n setError(errorMessage);\n }\n }\n setLoading(false);\n }\n\n return {\n error,\n setError,\n loading,\n setLoading,\n isTxStart,\n setIsTxStart,\n txHash,\n txPending,\n txSuccess,\n txChainId,\n txWalletType,\n isError,\n executeTxWithLocalStatuses,\n fullTxErrorMessage,\n setFullTxErrorMessage,\n };\n};\n","import { produce } from 'immer';\nimport { Hex } from 'viem';\n\nimport { setLocalStorageTxPool } from '../../utils/localStorage';\nimport { selectIsGelatoTXPending } from '../store/transactionsSelectors';\nimport {\n BaseTx,\n GelatoBaseTx,\n InitialTx,\n ITransactionsSlice,\n NewTx,\n} from '../store/transactionsSlice';\nimport { Wallet } from '../store/walletSlice';\nimport { AdapterInterface } from './interface';\n\nexport type GelatoTXState =\n | 'WaitingForConfirmation'\n | 'CheckPending'\n | 'ExecSuccess'\n | 'Cancelled'\n | 'ExecPending'\n | 'ExecReverted';\n\nexport type GelatoTaskStatusResponse = {\n task: {\n chainId: number;\n taskId: string;\n taskState: GelatoTXState;\n creationDate?: string;\n executionDate?: string;\n transactionHash?: Hex;\n blockNumber?: number;\n lastCheckMessage?: string;\n };\n};\n\nexport type GelatoTx = {\n taskId: string;\n};\n\nexport function isGelatoTx(tx: InitialTx): tx is GelatoTx {\n return (tx as GelatoTx).taskId !== undefined;\n}\n\nexport function isGelatoBaseTx(tx: BaseTx): tx is GelatoBaseTx {\n return (tx as GelatoBaseTx).taskId !== undefined;\n}\n\nexport function isGelatoBaseTxWithoutTimestamp(\n tx: Omit,\n): tx is Omit {\n return (tx as GelatoBaseTx).taskId !== undefined;\n}\n\nexport class GelatoAdapter implements AdapterInterface {\n get: () => ITransactionsSlice;\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void;\n transactionsIntervalsMap: Record = {};\n\n constructor(\n get: () => ITransactionsSlice,\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void,\n ) {\n this.get = get;\n this.set = set;\n }\n\n executeTx = async (params: {\n tx: NewTx;\n activeWallet: Wallet;\n payload: object | undefined;\n chainId: number;\n type: T['type'];\n }): Promise => {\n const { activeWallet, chainId, type } = params;\n const tx = params.tx as GelatoTx;\n const from = activeWallet.address;\n const gelatoTX = {\n from: from as Hex,\n chainId,\n type: type,\n taskId: tx.taskId,\n payload: params.payload,\n };\n\n const txPool = this.get().addTXToPool(gelatoTX, activeWallet.walletType);\n this.startTxTracking(tx.taskId);\n\n return txPool[tx.taskId];\n };\n\n startTxTracking = async (taskId: string) => {\n const tx = this.get().transactionsPool[taskId] as GelatoBaseTx;\n\n const isPending = selectIsGelatoTXPending(tx.gelatoStatus);\n if (!isPending) {\n return;\n }\n\n this.stopPollingGelatoTXStatus(taskId);\n\n const newGelatoInterval = setInterval(() => {\n this.fetchGelatoTXStatus(taskId);\n // TODO: maybe change timeout for gelato\n }, 2000);\n\n this.transactionsIntervalsMap[taskId] = Number(newGelatoInterval);\n };\n\n private stopPollingGelatoTXStatus = (taskId: string) => {\n const currentInterval = this.transactionsIntervalsMap[taskId];\n clearInterval(currentInterval);\n this.transactionsIntervalsMap[taskId] = undefined;\n };\n\n private fetchGelatoTXStatus = async (taskId: string) => {\n const response = await fetch(\n `https://api.gelato.digital/tasks/status/${taskId}/`,\n );\n if (!response.ok) {\n // TODO: handle error if needed, for now just skipping\n } else {\n const gelatoStatus = (await response.json()) as GelatoTaskStatusResponse;\n\n const isPending = selectIsGelatoTXPending(gelatoStatus.task.taskState);\n this.updateGelatoTX(taskId, gelatoStatus);\n if (!isPending) {\n this.stopPollingGelatoTXStatus(taskId);\n const tx = this.get().transactionsPool[taskId];\n this.get().txStatusChangedCallback(tx);\n }\n }\n };\n\n private updateGelatoTX = (\n taskId: string,\n statusResponse: GelatoTaskStatusResponse,\n ) => {\n this.set((state) =>\n produce(state, (draft) => {\n const tx = draft.transactionsPool[taskId] as GelatoBaseTx & {\n pending: boolean;\n status?: number;\n };\n tx.gelatoStatus = statusResponse.task.taskState;\n tx.pending = selectIsGelatoTXPending(statusResponse.task.taskState);\n tx.hash = statusResponse.task.transactionHash;\n tx.status =\n statusResponse.task.taskState === 'ExecSuccess'\n ? 1\n : tx.pending\n ? undefined\n : 0;\n if (statusResponse.task.executionDate) {\n tx.timestamp = new Date(statusResponse.task.executionDate).getTime();\n }\n if (statusResponse.task.lastCheckMessage) {\n tx.errorMessage = statusResponse.task.lastCheckMessage;\n }\n }),\n );\n setLocalStorageTxPool(this.get().transactionsPool);\n };\n}\n","import { WalletType } from '../web3/connectors';\nimport { BaseTx, TransactionPool } from '../web3/store/transactionsSlice';\n\nexport enum LocalStorageKeys {\n LastConnectedWallet = 'LastConnectedWallet',\n TransactionPool = 'TransactionPool',\n}\n\nexport const setLocalStorageTxPool = (\n pool: TransactionPool,\n) => {\n const stringifiedPool = JSON.stringify(pool);\n localStorage.setItem(LocalStorageKeys.TransactionPool, stringifiedPool);\n};\n\nexport const getLocalStorageTxPool = () => {\n return localStorage.getItem(LocalStorageKeys.TransactionPool);\n};\n\nexport const setLocalStorageWallet = (walletType: WalletType) => {\n localStorage.setItem(LocalStorageKeys.LastConnectedWallet, walletType);\n};\n\nexport const deleteLocalStorageWallet = () => {\n localStorage.removeItem(LocalStorageKeys.LastConnectedWallet);\n localStorage.removeItem('wagmi.wallet');\n};\n\nexport const clearWalletLinkLocalStorage = () => {\n localStorage.removeItem('walletconnect');\n localStorage.removeItem('-walletlink:https://www.walletlink.org:version');\n localStorage.removeItem('-walletlink:https://www.walletlink.org:session:id');\n localStorage.removeItem(\n '-walletlink:https://www.walletlink.org:session:secret',\n );\n localStorage.removeItem(\n '-walletlink:https://www.walletlink.org:session:linked',\n );\n localStorage.removeItem('-walletlink:https://www.walletlink.org:AppVersion');\n localStorage.removeItem('-walletlink:https://www.walletlink.org:Addresses');\n localStorage.removeItem(\n '-walletlink:https://www.walletlink.org:walletUsername',\n );\n};\n\nexport const clearWalletConnectV2LocalStorage = () => {\n localStorage.removeItem('wc@2:core:0.3//messages');\n localStorage.removeItem('wc@2:client:0.3//proposal');\n localStorage.removeItem('wc@2:universal_provider:/namespaces');\n localStorage.removeItem('wc@2:core:0.3//subscription');\n localStorage.removeItem('wc@2:core:0.3//history');\n localStorage.removeItem('wc@2:core:0.3//expirer');\n localStorage.removeItem('wc@2:core:0.3//pairing');\n localStorage.removeItem('wc@2:universal_provider:/optionalNamespaces');\n};\n","import isEqual from 'lodash/isEqual.js';\nimport { Chain } from 'viem';\nimport { goerli, mainnet } from 'viem/chains';\n\nimport { isGelatoBaseTx } from '../adapters/GelatoAdapter';\nimport { BaseTx, GelatoBaseTx, ITransactionsState } from './transactionsSlice';\n\nexport const selectAllTransactions = (\n state: ITransactionsState,\n) => {\n return Object.values(state.transactionsPool).sort(\n (a, b) => Number(a.localTimestamp) - Number(b.localTimestamp),\n );\n};\n\nexport const selectPendingTransactions = (\n state: ITransactionsState,\n) => {\n return selectAllTransactions(state).filter((tx) => tx.pending);\n};\n\nexport const selectTXByKey = (\n state: ITransactionsState,\n key: string,\n) => {\n return state.transactionsPool[key];\n};\n\nexport const selectTXByHash = (\n state: ITransactionsState,\n hash: string,\n) => {\n const txByKey = selectTXByKey(state, hash);\n if (txByKey) {\n return txByKey;\n }\n return selectAllTransactions(state).find((tx) => tx.hash === hash);\n};\n\nexport const selectAllTransactionsByWallet = (\n state: ITransactionsState,\n from: string,\n) => {\n return selectAllTransactions(state).filter((tx) => tx.from === from);\n};\n\nexport const selectPendingTransactionByWallet = (\n state: ITransactionsState,\n from: string,\n) => {\n return selectPendingTransactions(state).filter((tx) => tx.from === from);\n};\n\nexport const selectLastTxByTypeAndPayload = (\n state: ITransactionsState,\n from: string,\n type: T['type'],\n payload: T['payload'],\n) => {\n const allTransactions = selectAllTransactionsByWallet(state, from);\n const filteredTransactions = allTransactions.filter(\n (tx) => tx.type === type && isEqual(tx.payload, payload),\n );\n const lastFilteredTransaction =\n filteredTransactions[filteredTransactions.length - 1];\n\n if (lastFilteredTransaction) {\n if (isGelatoBaseTx(lastFilteredTransaction)) {\n return selectTXByKey(state, lastFilteredTransaction.taskId);\n } else {\n if (lastFilteredTransaction.hash) {\n return selectTXByKey(state, lastFilteredTransaction.hash);\n } else {\n return undefined;\n }\n }\n } else {\n return undefined;\n }\n};\n\nexport const selectTxExplorerLink = (\n state: ITransactionsState,\n getChainParameters: (chainId: number) => Chain,\n txHash: string,\n) => {\n const tx = selectTXByHash(state, txHash);\n if (!tx) {\n return '';\n }\n\n // TODO: need check\n const gnosisSafeLinksHelper: Record = {\n [mainnet.id]: 'https://app.safe.global/eth:',\n [goerli.id]: 'https://app.safe.global/gor:',\n };\n\n if (tx.walletType !== 'GnosisSafe') {\n return `${getChainParameters(tx.chainId).blockExplorers}/tx/${txHash}`;\n } else {\n return `${gnosisSafeLinksHelper[tx.chainId]}${\n tx.from\n }/transactions/tx?id=multisig_${tx.from}_${txHash}`;\n }\n};\n\nexport const selectIsGelatoTXPending = (\n gelatoStatus?: GelatoBaseTx['gelatoStatus'],\n) => {\n return (\n gelatoStatus === undefined ||\n gelatoStatus === 'CheckPending' ||\n gelatoStatus === 'WaitingForConfirmation' ||\n gelatoStatus === 'ExecPending'\n );\n};\n","import { Chain, createPublicClient, http, PublicClient } from 'viem';\nimport {\n avalanche,\n avalancheFuji,\n goerli,\n mainnet,\n polygon,\n polygonMumbai,\n sepolia,\n} from 'viem/chains';\n\nexport const initialChains: Record = {\n [mainnet.id]: mainnet,\n [polygon.id]: polygon,\n [polygonMumbai.id]: polygonMumbai,\n [avalanche.id]: avalanche,\n [avalancheFuji.id]: avalancheFuji,\n [goerli.id]: goerli,\n [sepolia.id]: sepolia,\n};\n\nexport const initChainInformationConfig = (chains?: Record) => {\n const CHAINS = { ...initialChains, ...chains } || {};\n\n // init clients instances from chain config\n const initalizedClients: Record = {};\n const clientInstances = Object.values(CHAINS).reduce<{\n [chainId: number]: {\n instance: PublicClient;\n };\n }>((accumulator, chain) => {\n const numberChainId = Number(chain.id);\n accumulator[numberChainId] = {\n get instance() {\n if (initalizedClients[numberChainId]) {\n return initalizedClients[numberChainId];\n } else {\n const client = createPublicClient({\n batch: {\n multicall: true,\n },\n chain,\n transport: http(),\n }) as PublicClient;\n initalizedClients[numberChainId] = client;\n return client;\n }\n },\n } as {\n instance: PublicClient;\n };\n return accumulator;\n }, {});\n\n function getChainParameters(chainId: number): Chain {\n const chainInformation = CHAINS[chainId];\n if (chainInformation) {\n return chainInformation;\n } else {\n // this case can only ever occure when a wallet is connected with an unknown chainId which will not allow interaction\n return {\n ...mainnet,\n id: chainId,\n name: `unknown network: ${chainId}`,\n };\n }\n }\n\n return {\n clientInstances,\n getChainParameters,\n };\n};\n","import {\n arbitrum,\n avalanche,\n goerli,\n mainnet,\n optimism,\n polygon,\n} from 'viem/chains';\n\nexport const SafeTransactionServiceUrls: { [key in number]: string } = {\n [mainnet.id]: 'https://safe-transaction-mainnet.safe.global/api/v1',\n [goerli.id]: 'https://safe-transaction-goerli.safe.global/api/v1',\n [optimism.id]: 'https://safe-transaction-optimism.safe.global/api/v1',\n [polygon.id]: 'https://safe-transaction-polygon.safe.global/api/v1',\n [arbitrum.id]: 'https://safe-transaction-arbitrum.safe.global/api/v1',\n [avalanche.id]: 'https://safe-transaction-avalanche.safe.global/api/v1',\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const alphawallet = {\n identityFlag: WalletIdentityFlag.AlphaWallet,\n label: WalletLabel.AlphaWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const atoken = {\n identityFlag: WalletIdentityFlag.AToken,\n label: WalletLabel.AToken,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const binance = {\n identityFlag: WalletIdentityFlag.Binance,\n label: WalletLabel.Binance,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const bitkeep = {\n identityFlag: WalletIdentityFlag.BitKeep,\n label: WalletLabel.BitKeep,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const bitpie = {\n identityFlag: WalletIdentityFlag.Bitpie,\n label: WalletLabel.Bitpie,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const bitski = {\n identityFlag: WalletIdentityFlag.Bitski,\n label: WalletLabel.Bitski,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const blockwallet = {\n identityFlag: WalletIdentityFlag.BlockWallet,\n label: WalletLabel.BlockWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const brave = {\n identityFlag: WalletIdentityFlag.BraveWallet,\n label: WalletLabel.Brave,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const coinbase = {\n identityFlag: WalletIdentityFlag.Coinbase,\n label: WalletLabel.Coinbase,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const core = {\n identityFlag: WalletIdentityFlag.Core,\n label: WalletLabel.Core,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const dcent = {\n identityFlag: WalletIdentityFlag.Dcent,\n label: WalletLabel.Dcent,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const defiwallet = {\n identityFlag: WalletIdentityFlag.DeFiWallet,\n label: WalletLabel.DeFiWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const enkrypt = {\n identityFlag: WalletIdentityFlag.Enkrypt,\n label: WalletLabel.Enkrypt,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const exodus = {\n identityFlag: WalletIdentityFlag.Exodus,\n label: WalletLabel.Exodus,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const frame = {\n identityFlag: WalletIdentityFlag.Frame,\n label: WalletLabel.Frame,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const frontier = {\n identityFlag: WalletIdentityFlag.Frontier,\n label: WalletLabel.Frontier,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const gamestop = {\n identityFlag: WalletIdentityFlag.GameStop,\n label: WalletLabel.GameStop,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const huobiwallet = {\n identityFlag: WalletIdentityFlag.HuobiWallet,\n label: WalletLabel.HuobiWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const hyperpay = {\n identityFlag: WalletIdentityFlag.HyperPay,\n label: WalletLabel.HyperPay,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const imtoken = {\n identityFlag: WalletIdentityFlag.ImToken,\n label: WalletLabel.ImToken,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const liquality = {\n identityFlag: WalletIdentityFlag.Liquality,\n label: WalletLabel.Liquality,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const mathwallet = {\n identityFlag: WalletIdentityFlag.MathWallet,\n label: WalletLabel.MathWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const meetone = {\n identityFlag: WalletIdentityFlag.MeetOne,\n label: WalletLabel.MeetOne,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const metamask = {\n identityFlag: WalletIdentityFlag.MetaMask,\n label: WalletLabel.MetaMask,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const mykey = {\n identityFlag: WalletIdentityFlag.MyKey,\n label: WalletLabel.MyKey,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const okxwallet = {\n identityFlag: WalletIdentityFlag.OKXWallet,\n label: WalletLabel.OKXWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const oneInch = {\n identityFlag: WalletIdentityFlag.OneInch,\n label: WalletLabel.OneInch,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const opera = {\n identityFlag: WalletIdentityFlag.Opera,\n label: WalletLabel.Opera,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const ownbit = {\n identityFlag: WalletIdentityFlag.OwnBit,\n label: WalletLabel.OwnBit,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const phantom = {\n identityFlag: WalletIdentityFlag.Phantom,\n label: WalletLabel.Phantom,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const rabby = {\n identityFlag: WalletIdentityFlag.Rabby,\n label: WalletLabel.Rabby,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const rainbow = {\n identityFlag: WalletIdentityFlag.Rainbow,\n label: WalletLabel.Rainbow,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const safepal = {\n identityFlag: WalletIdentityFlag.SafePal,\n label: WalletLabel.SafePal,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const sequence = {\n identityFlag: WalletIdentityFlag.Sequence,\n label: WalletLabel.Sequence,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const status = {\n identityFlag: WalletIdentityFlag.Status,\n label: WalletLabel.Status,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tallywallet = {\n identityFlag: WalletIdentityFlag.Tally,\n label: WalletLabel.Tally,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tokenary = {\n identityFlag: WalletIdentityFlag.Tokenary,\n label: WalletLabel.Tokenary,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tokenpocket = {\n identityFlag: WalletIdentityFlag.TokenPocket,\n label: WalletLabel.TokenPocket,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tp = {\n identityFlag: WalletIdentityFlag.TP,\n label: WalletLabel.TP,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const trust = {\n identityFlag: WalletIdentityFlag.Trust,\n label: WalletLabel.Trust,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const walletio = {\n identityFlag: WalletIdentityFlag.WalletIo,\n label: WalletLabel.WalletIo,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const xdefi = {\n identityFlag: WalletIdentityFlag.XDEFI,\n label: WalletLabel.XDEFI,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const zeal = {\n identityFlag: WalletIdentityFlag.Zeal,\n label: WalletLabel.Zeal,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const zerion = {\n identityFlag: WalletIdentityFlag.Zerion,\n label: WalletLabel.Zerion,\n icon: ``,\n};\n","import { alphawallet } from './wallets/alphawallet';\nimport { atoken } from './wallets/atoken';\nimport { binance } from './wallets/binance';\nimport { bitkeep } from './wallets/bitkeep';\nimport { bitpie } from './wallets/bitpie';\nimport { bitski } from './wallets/bitski';\nimport { blockwallet } from './wallets/blockwallet';\nimport { brave } from './wallets/brave';\nimport { coinbase } from './wallets/coinbase';\nimport { core } from './wallets/core';\nimport { dcent } from './wallets/dcent';\nimport { defiwallet } from './wallets/defiwallet';\nimport { enkrypt } from './wallets/enkrypt';\nimport { exodus } from './wallets/exodus';\nimport { frame } from './wallets/frame';\nimport { frontier } from './wallets/frontier';\nimport { gamestop } from './wallets/gamestop';\nimport { huobiwallet } from './wallets/huobiwallet';\nimport { hyperpay } from './wallets/hyperpay';\nimport { imtoken } from './wallets/imtoken';\nimport { liquality } from './wallets/liquality';\nimport { mathwallet } from './wallets/mathwallet';\nimport { meetone } from './wallets/meetone';\nimport { metamask } from './wallets/metamask';\nimport { mykey } from './wallets/mykey';\nimport { okxwallet } from './wallets/okxwallet';\nimport { oneInch } from './wallets/oneInch';\nimport { opera } from './wallets/opera';\nimport { ownbit } from './wallets/ownbit';\nimport { phantom } from './wallets/phantom';\nimport { rabby } from './wallets/rabby';\nimport { rainbow } from './wallets/rainbow';\nimport { safepal } from './wallets/safepal';\nimport { sequence } from './wallets/sequence';\nimport { status } from './wallets/status';\nimport { tallywallet } from './wallets/tallywallet';\nimport { tokenary } from './wallets/tokenary';\nimport { tokenpocket } from './wallets/tokenpocket';\nimport { tp } from './wallets/tp';\nimport { trust } from './wallets/trust';\nimport { walletio } from './wallets/walletio';\nimport { xdefi } from './wallets/xdefi';\nimport { zeal } from './wallets/zeal';\nimport { zerion } from './wallets/zerion';\n\nexport const wallets = [\n alphawallet,\n atoken,\n binance,\n bitkeep,\n bitpie,\n bitski,\n blockwallet,\n brave,\n coinbase,\n core,\n dcent,\n defiwallet,\n enkrypt,\n exodus,\n frame,\n frontier,\n gamestop,\n huobiwallet,\n hyperpay,\n imtoken,\n liquality,\n mathwallet,\n meetone,\n metamask,\n mykey,\n okxwallet,\n oneInch,\n opera,\n ownbit,\n phantom,\n rabby,\n rainbow,\n safepal,\n sequence,\n status,\n tallywallet,\n tokenary,\n tokenpocket,\n tp,\n trust,\n walletio,\n xdefi,\n zeal,\n zerion,\n];\n","export const defaultWallet = {\n label: 'Browser wallet',\n icon: ``,\n};\n","import { wallets } from './wallets';\nimport { defaultWallet } from './wallets/defaultWallet';\n\nexport function getBrowserWalletLabelAndIcon() {\n const defaultBrowserWallet = {\n label: defaultWallet.label,\n icon: defaultWallet.icon,\n };\n\n if (typeof window !== 'undefined') {\n if (!!window.ethereum) {\n const userBrowserWallets = wallets.filter(\n (wallet) => !!window.ethereum[wallet.identityFlag],\n );\n if (userBrowserWallets.length > 1 || userBrowserWallets.length === 0) {\n return defaultBrowserWallet;\n } else {\n return {\n label: userBrowserWallets[0].label,\n icon: userBrowserWallets[0].icon,\n };\n }\n } else {\n return defaultBrowserWallet;\n }\n } else {\n return defaultBrowserWallet;\n }\n}\n","import { Chain } from 'viem';\nimport { CoinbaseWalletConnector } from 'wagmi/connectors/coinbaseWallet';\nimport { InjectedConnector } from 'wagmi/connectors/injected';\nimport { SafeConnector } from 'wagmi/connectors/safe';\nimport { WalletConnectConnector } from 'wagmi/connectors/walletConnect';\n\nimport { ImpersonatedConnector } from './ImpersonatedConnector';\n\nexport type ConnectorType =\n | InjectedConnector\n | WalletConnectConnector\n | CoinbaseWalletConnector\n | SafeConnector\n | ImpersonatedConnector;\n\nexport type AllConnectorsInitProps = {\n appName: string;\n chains: Record;\n defaultChainId?: number;\n wcParams?: {\n projectId: string;\n metadata: {\n name: string;\n description: string;\n url: string;\n icons: string[];\n };\n };\n};\n\nexport const initAllConnectors = (props: AllConnectorsInitProps) => {\n const chains = Object.values(props.chains);\n const chainIds = Object.keys(props.chains).map(Number);\n\n const wcParams = props.wcParams;\n let walletConnect: WalletConnectConnector | null = null;\n if (wcParams) {\n walletConnect = new WalletConnectConnector({\n chains,\n options: {\n ...wcParams,\n },\n });\n }\n\n const injected = new InjectedConnector({\n chains,\n options: {\n name: (detectedName) =>\n `${\n typeof detectedName === 'string'\n ? detectedName\n : detectedName.join(', ')\n }`,\n },\n });\n const coinbase = new CoinbaseWalletConnector({\n chains,\n options: {\n appName: props.appName,\n jsonRpcUrl:\n props.chains[props.defaultChainId || chainIds[0]].rpcUrls.default\n .http[0],\n },\n });\n const gnosisSafe = new SafeConnector({\n chains,\n options: {\n allowedDomains: [/gnosis-safe.io$/, /app.safe.global$/],\n debug: false,\n },\n });\n\n const impersonated = new ImpersonatedConnector({\n chains,\n options: {\n chainId: props.chains[props.defaultChainId || chainIds[0]].id,\n },\n });\n\n const connectors: ConnectorType[] = [\n injected,\n coinbase,\n gnosisSafe,\n impersonated,\n ];\n if (walletConnect !== null) {\n connectors.push(walletConnect);\n }\n\n return connectors;\n};\n\nexport type WalletType =\n | 'Injected'\n | 'WalletConnect'\n | 'Coinbase'\n | 'GnosisSafe'\n | 'Impersonated';\n\nexport function getConnectorName(\n connector: ConnectorType,\n): WalletType | undefined {\n if (connector instanceof InjectedConnector) return 'Injected';\n if (connector instanceof WalletConnectConnector) return 'WalletConnect';\n if (connector instanceof CoinbaseWalletConnector) return 'Coinbase';\n if (connector instanceof SafeConnector) return 'GnosisSafe';\n if (connector instanceof ImpersonatedConnector) return 'Impersonated';\n return;\n}\n","// src/utils/normalizeChainId.ts\nfunction normalizeChainId(chainId) {\n if (typeof chainId === \"string\")\n return Number.parseInt(\n chainId,\n chainId.trim().substring(0, 2) === \"0x\" ? 16 : 10\n );\n if (typeof chainId === \"bigint\")\n return Number(chainId);\n return chainId;\n}\n\nexport {\n normalizeChainId\n};\n","var __accessCheck = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n};\nvar __privateGet = (obj, member, getter) => {\n __accessCheck(obj, member, \"read from private field\");\n return getter ? getter.call(obj) : member.get(obj);\n};\nvar __privateAdd = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n};\nvar __privateSet = (obj, member, value, setter) => {\n __accessCheck(obj, member, \"write to private field\");\n setter ? setter.call(obj, value) : member.set(obj, value);\n return value;\n};\nvar __privateMethod = (obj, member, method) => {\n __accessCheck(obj, member, \"access private method\");\n return method;\n};\n\n// src/base.ts\nimport { default as EventEmitter } from \"eventemitter3\";\nimport { goerli, mainnet } from \"viem/chains\";\nvar Connector = class extends EventEmitter {\n constructor({\n chains = [mainnet, goerli],\n options\n }) {\n super();\n this.chains = chains;\n this.options = options;\n }\n getBlockExplorerUrls(chain) {\n const { default: blockExplorer, ...blockExplorers } = chain.blockExplorers ?? {};\n if (blockExplorer)\n return [\n blockExplorer.url,\n ...Object.values(blockExplorers).map((x) => x.url)\n ];\n }\n isChainUnsupported(chainId) {\n return !this.chains.some((x) => x.id === chainId);\n }\n setStorage(storage) {\n this.storage = storage;\n }\n};\n\nexport {\n __privateGet,\n __privateAdd,\n __privateSet,\n __privateMethod,\n Connector\n};\n","import {\n normalizeChainId\n} from \"../chunk-OQILYQDO.js\";\nimport {\n Connector,\n __privateAdd,\n __privateGet,\n __privateMethod,\n __privateSet\n} from \"../chunk-W65LBPLT.js\";\n\n// src/mock/connector.ts\nimport { getAddress as getAddress2 } from \"viem\";\n\n// src/mock/provider.ts\nimport { default as EventEmitter } from \"eventemitter3\";\nimport { UserRejectedRequestError, getAddress } from \"viem\";\nvar _options, _walletClient;\nvar MockProvider = class {\n constructor(options) {\n this.events = new EventEmitter();\n __privateAdd(this, _options, void 0);\n __privateAdd(this, _walletClient, void 0);\n this.chainId = options.chainId;\n __privateSet(this, _options, options);\n }\n async enable() {\n if (__privateGet(this, _options).flags?.failConnect)\n throw new UserRejectedRequestError(new Error(\"Failed to connect.\"));\n if (!__privateGet(this, _walletClient))\n __privateSet(this, _walletClient, __privateGet(this, _options).walletClient);\n const address = __privateGet(this, _walletClient).account.address;\n this.events.emit(\"accountsChanged\", [address]);\n return [address];\n }\n async disconnect() {\n this.events.emit(\"disconnect\");\n __privateSet(this, _walletClient, void 0);\n }\n async getAccounts() {\n const address = __privateGet(this, _walletClient)?.account.address;\n if (!address)\n return [];\n return [getAddress(address)];\n }\n getWalletClient() {\n const walletClient = __privateGet(this, _walletClient);\n if (!walletClient)\n throw new Error(\"walletClient not found\");\n return walletClient;\n }\n async switchChain(chainId) {\n if (__privateGet(this, _options).flags?.failSwitchChain)\n throw new UserRejectedRequestError(new Error(\"Failed to switch chain.\"));\n __privateGet(this, _options).chainId = chainId;\n this.chainId = chainId;\n this.events.emit(\"chainChanged\", chainId);\n }\n async switchWalletClient(walletClient) {\n const address = walletClient.account.address;\n __privateSet(this, _walletClient, walletClient);\n this.events.emit(\"accountsChanged\", [address]);\n }\n async watchAsset(_asset) {\n return true;\n }\n async request({ method, params }) {\n return __privateGet(this, _walletClient)?.transport.request({ method, params });\n }\n on(event, listener) {\n this.events.on(event, listener);\n return this;\n }\n removeListener(event, listener) {\n this.events.removeListener(event, listener);\n return this;\n }\n toJSON() {\n return \"\";\n }\n};\n_options = new WeakMap();\n_walletClient = new WeakMap();\n\n// src/mock/connector.ts\nvar _provider, _switchChain, switchChain_fn;\nvar MockConnector = class extends Connector {\n constructor({\n chains,\n options\n }) {\n super({\n chains,\n options: {\n ...options,\n chainId: options.chainId ?? chains?.[0]?.id\n }\n });\n __privateAdd(this, _switchChain);\n this.id = \"mock\";\n this.name = \"Mock\";\n this.ready = true;\n __privateAdd(this, _provider, void 0);\n this.onAccountsChanged = (accounts) => {\n if (accounts.length === 0)\n this.emit(\"disconnect\");\n else\n this.emit(\"change\", { account: getAddress2(accounts[0]) });\n };\n this.onChainChanged = (chainId) => {\n const id = normalizeChainId(chainId);\n const unsupported = this.isChainUnsupported(id);\n this.emit(\"change\", { chain: { id, unsupported } });\n };\n this.onDisconnect = () => {\n this.emit(\"disconnect\");\n };\n }\n async connect({ chainId } = {}) {\n const provider = await this.getProvider({ chainId });\n provider.on(\"accountsChanged\", this.onAccountsChanged);\n provider.on(\"chainChanged\", this.onChainChanged);\n provider.on(\"disconnect\", this.onDisconnect);\n this.emit(\"message\", { type: \"connecting\" });\n const accounts = await provider.enable();\n const account = getAddress2(accounts[0]);\n const id = normalizeChainId(provider.chainId);\n const unsupported = this.isChainUnsupported(id);\n const data = { account, chain: { id, unsupported }, provider };\n if (!this.options.flags?.noSwitchChain)\n this.switchChain = __privateMethod(this, _switchChain, switchChain_fn);\n return new Promise(\n (res) => setTimeout(() => res(data), 100)\n );\n }\n async disconnect() {\n const provider = await this.getProvider();\n await provider.disconnect();\n provider.removeListener(\"accountsChanged\", this.onAccountsChanged);\n provider.removeListener(\"chainChanged\", this.onChainChanged);\n provider.removeListener(\"disconnect\", this.onDisconnect);\n }\n async getAccount() {\n const provider = await this.getProvider();\n const accounts = await provider.getAccounts();\n const account = accounts[0];\n if (!account)\n throw new Error(\"Failed to get account\");\n return getAddress2(account);\n }\n async getChainId() {\n const provider = await this.getProvider();\n return normalizeChainId(provider.chainId);\n }\n async getProvider({ chainId } = {}) {\n if (!__privateGet(this, _provider) || chainId)\n __privateSet(this, _provider, new MockProvider({\n ...this.options,\n chainId: chainId ?? this.options.chainId ?? this.chains[0].id\n }));\n return __privateGet(this, _provider);\n }\n async getWalletClient() {\n const provider = await this.getProvider();\n return provider.getWalletClient();\n }\n async isAuthorized() {\n try {\n const provider = await this.getProvider();\n const account = await provider.getAccounts();\n return this.options.flags?.isAuthorized ?? !!account;\n } catch {\n return false;\n }\n }\n async watchAsset(asset) {\n const provider = await this.getProvider();\n return provider.watchAsset(asset);\n }\n toJSON() {\n return \"\";\n }\n};\n_provider = new WeakMap();\n_switchChain = new WeakSet();\nswitchChain_fn = async function(chainId) {\n const provider = await this.getProvider();\n await provider.switchChain(chainId);\n return this.chains.find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${chainId}`,\n network: `${chainId}`,\n nativeCurrency: { name: \"Ether\", decimals: 18, symbol: \"ETH\" },\n rpcUrls: { default: { http: [\"\"] }, public: { http: [\"\"] } }\n };\n};\nexport {\n MockConnector,\n MockProvider\n};\n","// src/errors.ts\nvar ChainNotConfiguredForConnectorError = class extends Error {\n constructor({\n chainId,\n connectorId\n }) {\n super(`Chain \"${chainId}\" not configured for connector \"${connectorId}\".`);\n this.name = \"ChainNotConfiguredForConnectorError\";\n }\n};\nvar ConnectorNotFoundError = class extends Error {\n constructor() {\n super(...arguments);\n this.name = \"ConnectorNotFoundError\";\n this.message = \"Connector not found\";\n }\n};\n\nexport {\n ChainNotConfiguredForConnectorError,\n ConnectorNotFoundError\n};\n","import {\n ChainNotConfiguredForConnectorError,\n ConnectorNotFoundError\n} from \"./chunk-UGBGYVBH.js\";\nimport {\n normalizeChainId\n} from \"./chunk-OQILYQDO.js\";\nimport {\n Connector,\n __privateAdd,\n __privateGet,\n __privateSet\n} from \"./chunk-W65LBPLT.js\";\n\n// src/injected.ts\nimport {\n ResourceUnavailableRpcError,\n SwitchChainError,\n UserRejectedRequestError,\n createWalletClient,\n custom,\n getAddress,\n numberToHex\n} from \"viem\";\n\n// src/utils/getInjectedName.ts\nfunction getInjectedName(ethereum) {\n if (!ethereum)\n return \"Injected\";\n const getName = (provider) => {\n if (provider.isApexWallet)\n return \"Apex Wallet\";\n if (provider.isAvalanche)\n return \"Core Wallet\";\n if (provider.isBackpack)\n return \"Backpack\";\n if (provider.isBifrost)\n return \"Bifrost Wallet\";\n if (provider.isBitKeep)\n return \"BitKeep\";\n if (provider.isBitski)\n return \"Bitski\";\n if (provider.isBlockWallet)\n return \"BlockWallet\";\n if (provider.isBraveWallet)\n return \"Brave Wallet\";\n if (provider.isCoin98)\n return \"Coin98 Wallet\";\n if (provider.isCoinbaseWallet)\n return \"Coinbase Wallet\";\n if (provider.isDawn)\n return \"Dawn Wallet\";\n if (provider.isDefiant)\n return \"Defiant\";\n if (provider.isDesig)\n return \"Desig Wallet\";\n if (provider.isEnkrypt)\n return \"Enkrypt\";\n if (provider.isExodus)\n return \"Exodus\";\n if (provider.isFordefi)\n return \"Fordefi\";\n if (provider.isFrame)\n return \"Frame\";\n if (provider.isFrontier)\n return \"Frontier Wallet\";\n if (provider.isGamestop)\n return \"GameStop Wallet\";\n if (provider.isHaqqWallet)\n return \"HAQQ Wallet\";\n if (provider.isHyperPay)\n return \"HyperPay Wallet\";\n if (provider.isImToken)\n return \"ImToken\";\n if (provider.isHaloWallet)\n return \"Halo Wallet\";\n if (provider.isKuCoinWallet)\n return \"KuCoin Wallet\";\n if (provider.isMathWallet)\n return \"MathWallet\";\n if (provider.isNovaWallet)\n return \"Nova Wallet\";\n if (provider.isOkxWallet || provider.isOKExWallet)\n return \"OKX Wallet\";\n if (provider.isOneInchIOSWallet || provider.isOneInchAndroidWallet)\n return \"1inch Wallet\";\n if (provider.isOpera)\n return \"Opera\";\n if (provider.isPhantom)\n return \"Phantom\";\n if (provider.isPortal)\n return \"Ripio Portal\";\n if (provider.isRabby)\n return \"Rabby Wallet\";\n if (provider.isRainbow)\n return \"Rainbow\";\n if (provider.isStatus)\n return \"Status\";\n if (provider.isSubWallet)\n return \"SubWallet\";\n if (provider.isTalisman)\n return \"Talisman\";\n if (provider.isTally)\n return \"Taho\";\n if (provider.isTokenPocket)\n return \"TokenPocket\";\n if (provider.isTokenary)\n return \"Tokenary\";\n if (provider.isTrust || provider.isTrustWallet)\n return \"Trust Wallet\";\n if (provider.isTTWallet)\n return \"TTWallet\";\n if (provider.isXDEFI)\n return \"XDEFI Wallet\";\n if (provider.isZeal)\n return \"Zeal\";\n if (provider.isZerion)\n return \"Zerion\";\n if (provider.isMetaMask)\n return \"MetaMask\";\n };\n if (ethereum.providers?.length) {\n const nameSet = /* @__PURE__ */ new Set();\n let unknownCount = 1;\n for (const provider of ethereum.providers) {\n let name = getName(provider);\n if (!name) {\n name = `Unknown Wallet #${unknownCount}`;\n unknownCount += 1;\n }\n nameSet.add(name);\n }\n const names = [...nameSet];\n if (names.length)\n return names;\n return names[0] ?? \"Injected\";\n }\n return getName(ethereum) ?? \"Injected\";\n}\n\n// src/injected.ts\nvar _provider;\nvar InjectedConnector = class extends Connector {\n constructor({\n chains,\n options: options_\n } = {}) {\n const options = {\n shimDisconnect: true,\n getProvider() {\n if (typeof window === \"undefined\")\n return;\n const ethereum = window.ethereum;\n if (ethereum?.providers)\n return ethereum.providers[0];\n return ethereum;\n },\n ...options_\n };\n super({ chains, options });\n this.id = \"injected\";\n __privateAdd(this, _provider, void 0);\n this.shimDisconnectKey = `${this.id}.shimDisconnect`;\n this.onAccountsChanged = (accounts) => {\n if (accounts.length === 0)\n this.emit(\"disconnect\");\n else\n this.emit(\"change\", {\n account: getAddress(accounts[0])\n });\n };\n this.onChainChanged = (chainId) => {\n const id = normalizeChainId(chainId);\n const unsupported = this.isChainUnsupported(id);\n this.emit(\"change\", { chain: { id, unsupported } });\n };\n this.onDisconnect = async (error) => {\n if (error.code === 1013) {\n const provider = await this.getProvider();\n if (provider) {\n const isAuthorized = await this.getAccount();\n if (isAuthorized)\n return;\n }\n }\n this.emit(\"disconnect\");\n if (this.options.shimDisconnect)\n this.storage?.removeItem(this.shimDisconnectKey);\n };\n const provider = options.getProvider();\n if (typeof options.name === \"string\")\n this.name = options.name;\n else if (provider) {\n const detectedName = getInjectedName(provider);\n if (options.name)\n this.name = options.name(detectedName);\n else {\n if (typeof detectedName === \"string\")\n this.name = detectedName;\n else\n this.name = detectedName[0];\n }\n } else\n this.name = \"Injected\";\n this.ready = !!provider;\n }\n async connect({ chainId } = {}) {\n try {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n if (provider.on) {\n provider.on(\"accountsChanged\", this.onAccountsChanged);\n provider.on(\"chainChanged\", this.onChainChanged);\n provider.on(\"disconnect\", this.onDisconnect);\n }\n this.emit(\"message\", { type: \"connecting\" });\n const accounts = await provider.request({\n method: \"eth_requestAccounts\"\n });\n const account = getAddress(accounts[0]);\n let id = await this.getChainId();\n let unsupported = this.isChainUnsupported(id);\n if (chainId && id !== chainId) {\n const chain = await this.switchChain(chainId);\n id = chain.id;\n unsupported = this.isChainUnsupported(id);\n }\n if (this.options.shimDisconnect)\n this.storage?.setItem(this.shimDisconnectKey, true);\n return { account, chain: { id, unsupported } };\n } catch (error) {\n if (this.isUserRejectedRequestError(error))\n throw new UserRejectedRequestError(error);\n if (error.code === -32002)\n throw new ResourceUnavailableRpcError(error);\n throw error;\n }\n }\n async disconnect() {\n const provider = await this.getProvider();\n if (!provider?.removeListener)\n return;\n provider.removeListener(\"accountsChanged\", this.onAccountsChanged);\n provider.removeListener(\"chainChanged\", this.onChainChanged);\n provider.removeListener(\"disconnect\", this.onDisconnect);\n if (this.options.shimDisconnect)\n this.storage?.removeItem(this.shimDisconnectKey);\n }\n async getAccount() {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n const accounts = await provider.request({\n method: \"eth_accounts\"\n });\n return getAddress(accounts[0]);\n }\n async getChainId() {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n return provider.request({ method: \"eth_chainId\" }).then(normalizeChainId);\n }\n async getProvider() {\n const provider = this.options.getProvider();\n if (provider)\n __privateSet(this, _provider, provider);\n return __privateGet(this, _provider);\n }\n async getWalletClient({\n chainId\n } = {}) {\n const [provider, account] = await Promise.all([\n this.getProvider(),\n this.getAccount()\n ]);\n const chain = this.chains.find((x) => x.id === chainId);\n if (!provider)\n throw new Error(\"provider is required.\");\n return createWalletClient({\n account,\n chain,\n transport: custom(provider)\n });\n }\n async isAuthorized() {\n try {\n if (this.options.shimDisconnect && !this.storage?.getItem(this.shimDisconnectKey))\n return false;\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n const account = await this.getAccount();\n return !!account;\n } catch {\n return false;\n }\n }\n async switchChain(chainId) {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n const id = numberToHex(chainId);\n try {\n await Promise.all([\n provider.request({\n method: \"wallet_switchEthereumChain\",\n params: [{ chainId: id }]\n }),\n new Promise(\n (res) => this.on(\"change\", ({ chain }) => {\n if (chain?.id === chainId)\n res();\n })\n )\n ]);\n return this.chains.find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${id}`,\n network: `${id}`,\n nativeCurrency: { name: \"Ether\", decimals: 18, symbol: \"ETH\" },\n rpcUrls: { default: { http: [\"\"] }, public: { http: [\"\"] } }\n };\n } catch (error) {\n const chain = this.chains.find((x) => x.id === chainId);\n if (!chain)\n throw new ChainNotConfiguredForConnectorError({\n chainId,\n connectorId: this.id\n });\n if (error.code === 4902 || error?.data?.originalError?.code === 4902) {\n try {\n await provider.request({\n method: \"wallet_addEthereumChain\",\n params: [\n {\n chainId: id,\n chainName: chain.name,\n nativeCurrency: chain.nativeCurrency,\n rpcUrls: [chain.rpcUrls.public?.http[0] ?? \"\"],\n blockExplorerUrls: this.getBlockExplorerUrls(chain)\n }\n ]\n });\n const currentChainId = await this.getChainId();\n if (currentChainId !== chainId)\n throw new UserRejectedRequestError(\n new Error(\"User rejected switch after adding network.\")\n );\n return chain;\n } catch (error2) {\n throw new UserRejectedRequestError(error2);\n }\n }\n if (this.isUserRejectedRequestError(error))\n throw new UserRejectedRequestError(error);\n throw new SwitchChainError(error);\n }\n }\n async watchAsset({\n address,\n decimals = 18,\n image,\n symbol\n }) {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n return provider.request({\n method: \"wallet_watchAsset\",\n params: {\n type: \"ERC20\",\n options: {\n address,\n decimals,\n image,\n symbol\n }\n }\n });\n }\n isUserRejectedRequestError(error) {\n return error.code === 4001;\n }\n};\n_provider = new WeakMap();\n\nexport {\n InjectedConnector\n};\n","var __accessCheck = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n};\nvar __privateGet = (obj, member, getter) => {\n __accessCheck(obj, member, \"read from private field\");\n return getter ? getter.call(obj) : member.get(obj);\n};\nvar __privateAdd = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n};\nvar __privateSet = (obj, member, value, setter) => {\n __accessCheck(obj, member, \"write to private field\");\n setter ? setter.call(obj, value) : member.set(obj, value);\n return value;\n};\nvar __privateMethod = (obj, member, method) => {\n __accessCheck(obj, member, \"access private method\");\n return method;\n};\n\nexport {\n __privateGet,\n __privateAdd,\n __privateSet,\n __privateMethod\n};\n","import {\n InjectedConnector\n} from \"./chunk-BVC4KGLQ.js\";\nimport {\n __privateAdd,\n __privateGet,\n __privateMethod,\n __privateSet\n} from \"./chunk-MQXBDTVK.js\";\n\n// src/utils/configureChains.ts\nimport { createPublicClient, fallback, http, webSocket } from \"viem\";\nfunction configureChains(defaultChains, providers, {\n batch = { multicall: { wait: 32 } },\n pollingInterval = 4e3,\n rank,\n retryCount,\n retryDelay,\n stallTimeout\n} = {}) {\n if (!defaultChains.length)\n throw new Error(\"must have at least one chain\");\n let chains = [];\n const httpUrls = {};\n const wsUrls = {};\n for (const chain of defaultChains) {\n let configExists = false;\n for (const provider of providers) {\n const apiConfig = provider(chain);\n if (!apiConfig)\n continue;\n configExists = true;\n if (!chains.some(({ id }) => id === chain.id)) {\n chains = [...chains, apiConfig.chain];\n }\n httpUrls[chain.id] = [\n ...httpUrls[chain.id] || [],\n ...apiConfig.rpcUrls.http\n ];\n if (apiConfig.rpcUrls.webSocket) {\n wsUrls[chain.id] = [\n ...wsUrls[chain.id] || [],\n ...apiConfig.rpcUrls.webSocket\n ];\n }\n }\n if (!configExists) {\n throw new Error(\n [\n `Could not find valid provider configuration for chain \"${chain.name}\".\n`,\n \"You may need to add `jsonRpcProvider` to `configureChains` with the chain's RPC URLs.\",\n \"Read more: https://wagmi.sh/core/providers/jsonRpc\"\n ].join(\"\\n\")\n );\n }\n }\n return {\n chains,\n publicClient: ({ chainId }) => {\n const activeChain = chains.find((x) => x.id === chainId) ?? defaultChains[0];\n const chainHttpUrls = httpUrls[activeChain.id];\n if (!chainHttpUrls || !chainHttpUrls[0])\n throw new Error(`No providers configured for chain \"${activeChain.id}\"`);\n const publicClient = createPublicClient({\n batch,\n chain: activeChain,\n transport: fallback(\n chainHttpUrls.map((url) => http(url, { timeout: stallTimeout })),\n { rank, retryCount, retryDelay }\n ),\n pollingInterval\n });\n return Object.assign(publicClient, {\n chains\n });\n },\n webSocketPublicClient: ({ chainId }) => {\n const activeChain = chains.find((x) => x.id === chainId) ?? defaultChains[0];\n const chainWsUrls = wsUrls[activeChain.id];\n if (!chainWsUrls || !chainWsUrls[0])\n return void 0;\n const publicClient = createPublicClient({\n batch,\n chain: activeChain,\n transport: fallback(\n chainWsUrls.map((url) => webSocket(url, { timeout: stallTimeout })),\n { rank, retryCount, retryDelay }\n ),\n pollingInterval\n });\n return Object.assign(publicClient, {\n chains\n });\n }\n };\n}\n\n// src/errors.ts\nimport { ConnectorNotFoundError } from \"@wagmi/connectors\";\nvar ChainMismatchError = class extends Error {\n constructor({\n activeChain,\n targetChain\n }) {\n super(\n `Chain mismatch: Expected \"${targetChain}\", received \"${activeChain}\".`\n );\n this.name = \"ChainMismatchError\";\n }\n};\nvar ChainNotConfiguredError = class extends Error {\n constructor({\n chainId,\n connectorId\n }) {\n super(\n `Chain \"${chainId}\" not configured${connectorId ? ` for connector \"${connectorId}\"` : \"\"}.`\n );\n this.name = \"ChainNotConfigured\";\n }\n};\nvar ConnectorAlreadyConnectedError = class extends Error {\n constructor() {\n super(...arguments);\n this.name = \"ConnectorAlreadyConnectedError\";\n this.message = \"Connector already connected\";\n }\n};\nvar ConfigChainsNotFound = class extends Error {\n constructor() {\n super(...arguments);\n this.name = \"ConfigChainsNotFound\";\n this.message = \"No chains were found on the wagmi config. Some functions that require a chain may not work.\";\n }\n};\nvar SwitchChainNotSupportedError = class extends Error {\n constructor({ connector }) {\n super(`\"${connector.name}\" does not support programmatic chain switching.`);\n this.name = \"SwitchChainNotSupportedError\";\n }\n};\n\n// src/utils/deepEqual.ts\nfunction 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 return a !== a && b !== b;\n}\n\n// src/utils/deserialize.ts\nvar findAndReplace = (cacheRef, {\n find,\n replace\n}) => {\n if (cacheRef && find(cacheRef)) {\n return replace(cacheRef);\n }\n if (typeof cacheRef !== \"object\") {\n return cacheRef;\n }\n if (Array.isArray(cacheRef)) {\n return cacheRef.map((item) => findAndReplace(item, { find, replace }));\n }\n if (cacheRef instanceof Object) {\n return Object.entries(cacheRef).reduce(\n (curr, [key, value]) => ({\n ...curr,\n [key]: findAndReplace(value, { find, replace })\n }),\n {}\n );\n }\n return cacheRef;\n};\nfunction deserialize(cachedString) {\n const cache = JSON.parse(cachedString);\n const deserializedCacheWithBigInts = findAndReplace(cache, {\n find: (data) => typeof data === \"string\" && data.startsWith(\"#bigint.\"),\n replace: (data) => BigInt(data.replace(\"#bigint.\", \"\"))\n });\n return deserializedCacheWithBigInts;\n}\n\n// src/utils/getParameters.ts\nfunction getCallParameters(args) {\n return {\n accessList: args.accessList,\n account: args.account,\n blockNumber: args.blockNumber,\n blockTag: args.blockTag,\n data: args.data,\n gas: args.gas,\n gasPrice: args.gasPrice,\n maxFeePerGas: args.maxFeePerGas,\n maxPriorityFeePerGas: args.maxPriorityFeePerGas,\n nonce: args.nonce,\n to: args.to,\n value: args.value\n };\n}\nfunction getSendTransactionParameters(args) {\n return {\n accessList: args.accessList,\n account: args.account,\n data: args.data,\n gas: args.gas,\n gasPrice: args.gasPrice,\n maxFeePerGas: args.maxFeePerGas,\n maxPriorityFeePerGas: args.maxPriorityFeePerGas,\n nonce: args.nonce,\n to: args.to,\n value: args.value\n };\n}\n\n// src/utils/getUnit.ts\nimport { weiUnits } from \"viem\";\nfunction 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\n// src/utils/serialize.ts\nfunction getReferenceKey(keys, cutoff) {\n return keys.slice(0, cutoff).join(\".\") || \".\";\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}\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 } 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 ? circularReplacer.call(\n this,\n key,\n value,\n getReferenceKey(keys, valueCutoff)\n ) : `[ref=${getReferenceKey(keys, valueCutoff)}]`;\n }\n } else {\n cache[0] = value;\n keys[0] = key;\n }\n }\n return hasReplacer ? replacer.call(this, key, value) : value;\n };\n}\nfunction serialize(value, replacer, indent, circularReplacer) {\n return JSON.stringify(\n value,\n createReplacer((key, value_) => {\n const value2 = typeof value_ === \"bigint\" ? `#bigint.${value_.toString()}` : value_;\n return replacer?.(key, value2) || value2;\n }, circularReplacer),\n indent ?? void 0\n );\n}\n\n// src/config.ts\nimport { persist, subscribeWithSelector } from \"zustand/middleware\";\nimport { createStore } from \"zustand/vanilla\";\n\n// src/storage.ts\nvar noopStorage = {\n getItem: (_key) => \"\",\n setItem: (_key, _value) => null,\n removeItem: (_key) => null\n};\nfunction createStorage({\n deserialize: deserialize2 = deserialize,\n key: prefix = \"wagmi\",\n serialize: serialize2 = serialize,\n storage\n}) {\n return {\n ...storage,\n getItem: (key, defaultState = null) => {\n const value = storage.getItem(`${prefix}.${key}`);\n try {\n return value ? deserialize2(value) : defaultState;\n } catch (error) {\n console.warn(error);\n return defaultState;\n }\n },\n setItem: (key, value) => {\n if (value === null) {\n storage.removeItem(`${prefix}.${key}`);\n } else {\n try {\n storage.setItem(`${prefix}.${key}`, serialize2(value));\n } catch (err) {\n console.error(err);\n }\n }\n },\n removeItem: (key) => storage.removeItem(`${prefix}.${key}`)\n };\n}\n\n// src/config.ts\nvar storeKey = \"store\";\nvar _isAutoConnecting, _lastUsedConnector, _addEffects, addEffects_fn;\nvar Config = class {\n constructor({\n autoConnect = false,\n connectors = [new InjectedConnector()],\n publicClient,\n storage = createStorage({\n storage: typeof window !== \"undefined\" ? window.localStorage : noopStorage\n }),\n logger = {\n warn: console.warn\n },\n webSocketPublicClient\n }) {\n __privateAdd(this, _addEffects);\n this.publicClients = /* @__PURE__ */ new Map();\n this.webSocketPublicClients = /* @__PURE__ */ new Map();\n __privateAdd(this, _isAutoConnecting, void 0);\n __privateAdd(this, _lastUsedConnector, void 0);\n this.args = {\n autoConnect,\n connectors,\n logger,\n publicClient,\n storage,\n webSocketPublicClient\n };\n let status = \"disconnected\";\n let chainId;\n if (autoConnect) {\n try {\n const rawState = storage.getItem(storeKey);\n const data = rawState?.state?.data;\n status = data?.account ? \"reconnecting\" : \"connecting\";\n chainId = data?.chain?.id;\n } catch (_error) {\n }\n }\n const connectors_ = typeof connectors === \"function\" ? connectors() : connectors;\n connectors_.forEach((connector) => connector.setStorage(storage));\n this.store = createStore(\n subscribeWithSelector(\n persist(\n () => ({\n connectors: connectors_,\n publicClient: this.getPublicClient({ chainId }),\n status,\n webSocketPublicClient: this.getWebSocketPublicClient({ chainId })\n }),\n {\n name: storeKey,\n storage,\n partialize: (state) => ({\n ...autoConnect && {\n data: {\n account: state?.data?.account,\n chain: state?.data?.chain\n }\n },\n chains: state?.chains\n }),\n version: 2\n }\n )\n )\n );\n this.storage = storage;\n __privateSet(this, _lastUsedConnector, storage?.getItem(\"wallet\"));\n __privateMethod(this, _addEffects, addEffects_fn).call(this);\n if (autoConnect && typeof window !== \"undefined\")\n setTimeout(async () => await this.autoConnect(), 0);\n }\n get chains() {\n return this.store.getState().chains;\n }\n get connectors() {\n return this.store.getState().connectors;\n }\n get connector() {\n return this.store.getState().connector;\n }\n get data() {\n return this.store.getState().data;\n }\n get error() {\n return this.store.getState().error;\n }\n get lastUsedChainId() {\n return this.data?.chain?.id;\n }\n get publicClient() {\n return this.store.getState().publicClient;\n }\n get status() {\n return this.store.getState().status;\n }\n get subscribe() {\n return this.store.subscribe;\n }\n get webSocketPublicClient() {\n return this.store.getState().webSocketPublicClient;\n }\n setState(updater) {\n const newState = typeof updater === \"function\" ? updater(this.store.getState()) : updater;\n this.store.setState(newState, true);\n }\n clearState() {\n this.setState((x) => ({\n ...x,\n chains: void 0,\n connector: void 0,\n data: void 0,\n error: void 0,\n status: \"disconnected\"\n }));\n }\n async destroy() {\n if (this.connector)\n await this.connector.disconnect?.();\n __privateSet(this, _isAutoConnecting, false);\n this.clearState();\n this.store.destroy();\n }\n async autoConnect() {\n if (__privateGet(this, _isAutoConnecting))\n return;\n __privateSet(this, _isAutoConnecting, true);\n this.setState((x) => ({\n ...x,\n status: x.data?.account ? \"reconnecting\" : \"connecting\"\n }));\n const sorted = __privateGet(this, _lastUsedConnector) ? [...this.connectors].sort(\n (x) => x.id === __privateGet(this, _lastUsedConnector) ? -1 : 1\n ) : this.connectors;\n let connected = false;\n for (const connector of sorted) {\n if (!connector.ready || !connector.isAuthorized)\n continue;\n const isAuthorized = await connector.isAuthorized();\n if (!isAuthorized)\n continue;\n const data = await connector.connect();\n this.setState((x) => ({\n ...x,\n connector,\n chains: connector?.chains,\n data,\n status: \"connected\"\n }));\n connected = true;\n break;\n }\n if (!connected)\n this.setState((x) => ({\n ...x,\n data: void 0,\n status: \"disconnected\"\n }));\n __privateSet(this, _isAutoConnecting, false);\n return this.data;\n }\n setConnectors(connectors) {\n this.args = {\n ...this.args,\n connectors\n };\n const connectors_ = typeof connectors === \"function\" ? connectors() : connectors;\n connectors_.forEach((connector) => connector.setStorage(this.args.storage));\n this.setState((x) => ({\n ...x,\n connectors: connectors_\n }));\n }\n getPublicClient({ chainId } = {}) {\n let publicClient_ = this.publicClients.get(-1);\n if (publicClient_ && publicClient_?.chain.id === chainId)\n return publicClient_;\n publicClient_ = this.publicClients.get(chainId ?? -1);\n if (publicClient_)\n return publicClient_;\n const { publicClient } = this.args;\n publicClient_ = typeof publicClient === \"function\" ? publicClient({ chainId }) : publicClient;\n this.publicClients.set(chainId ?? -1, publicClient_);\n return publicClient_;\n }\n setPublicClient(publicClient) {\n const chainId = this.data?.chain?.id;\n this.args = {\n ...this.args,\n publicClient\n };\n this.publicClients.clear();\n this.setState((x) => ({\n ...x,\n publicClient: this.getPublicClient({ chainId })\n }));\n }\n getWebSocketPublicClient({ chainId } = {}) {\n let webSocketPublicClient_ = this.webSocketPublicClients.get(-1);\n if (webSocketPublicClient_ && webSocketPublicClient_?.chain.id === chainId)\n return webSocketPublicClient_;\n webSocketPublicClient_ = this.webSocketPublicClients.get(chainId ?? -1);\n if (webSocketPublicClient_)\n return webSocketPublicClient_;\n const { webSocketPublicClient } = this.args;\n webSocketPublicClient_ = typeof webSocketPublicClient === \"function\" ? webSocketPublicClient({ chainId }) : webSocketPublicClient;\n if (webSocketPublicClient_)\n this.webSocketPublicClients.set(chainId ?? -1, webSocketPublicClient_);\n return webSocketPublicClient_;\n }\n setWebSocketPublicClient(webSocketPublicClient) {\n const chainId = this.data?.chain?.id;\n this.args = {\n ...this.args,\n webSocketPublicClient\n };\n this.webSocketPublicClients.clear();\n this.setState((x) => ({\n ...x,\n webSocketPublicClient: this.getWebSocketPublicClient({\n chainId\n })\n }));\n }\n setLastUsedConnector(lastUsedConnector = null) {\n this.storage?.setItem(\"wallet\", lastUsedConnector);\n }\n};\n_isAutoConnecting = new WeakMap();\n_lastUsedConnector = new WeakMap();\n_addEffects = new WeakSet();\naddEffects_fn = function() {\n const onChange = (data) => {\n this.setState((x) => ({\n ...x,\n data: { ...x.data, ...data }\n }));\n };\n const onDisconnect = () => {\n this.clearState();\n };\n const onError = (error) => {\n this.setState((x) => ({ ...x, error }));\n };\n this.store.subscribe(\n ({ connector }) => connector,\n (connector, prevConnector) => {\n prevConnector?.off?.(\"change\", onChange);\n prevConnector?.off?.(\"disconnect\", onDisconnect);\n prevConnector?.off?.(\"error\", onError);\n if (!connector)\n return;\n connector.on?.(\"change\", onChange);\n connector.on?.(\"disconnect\", onDisconnect);\n connector.on?.(\"error\", onError);\n }\n );\n const { publicClient, webSocketPublicClient } = this.args;\n const subscribePublicClient = typeof publicClient === \"function\";\n const subscribeWebSocketPublicClient = typeof webSocketPublicClient === \"function\";\n if (subscribePublicClient || subscribeWebSocketPublicClient)\n this.store.subscribe(\n ({ data }) => data?.chain?.id,\n (chainId) => {\n this.setState((x) => ({\n ...x,\n publicClient: this.getPublicClient({ chainId }),\n webSocketPublicClient: this.getWebSocketPublicClient({\n chainId\n })\n }));\n }\n );\n};\nvar config;\nfunction createConfig(args) {\n const config_ = new Config(args);\n config = config_;\n return config_;\n}\nfunction getConfig() {\n if (!config) {\n throw new Error(\n \"No wagmi config found. Ensure you have set up a config: https://wagmi.sh/react/config\"\n );\n }\n return config;\n}\n\n// src/actions/accounts/connect.ts\nasync function connect({ chainId, connector }) {\n const config2 = getConfig();\n const activeConnector = config2.connector;\n if (activeConnector && connector.id === activeConnector.id)\n throw new ConnectorAlreadyConnectedError();\n try {\n config2.setState((x) => ({ ...x, status: \"connecting\" }));\n const data = await connector.connect({ chainId });\n config2.setLastUsedConnector(connector.id);\n config2.setState((x) => ({\n ...x,\n connector,\n chains: connector?.chains,\n data,\n status: \"connected\"\n }));\n config2.storage.setItem(\"connected\", true);\n return { ...data, connector };\n } catch (err) {\n config2.setState((x) => {\n return {\n ...x,\n status: x.connector ? \"connected\" : \"disconnected\"\n };\n });\n throw err;\n }\n}\n\n// src/actions/accounts/disconnect.ts\nasync function disconnect() {\n const config2 = getConfig();\n if (config2.connector)\n await config2.connector.disconnect();\n config2.clearState();\n config2.storage.removeItem(\"connected\");\n}\n\n// src/actions/accounts/fetchBalance.ts\nimport {\n ContractFunctionExecutionError as ContractFunctionExecutionError3,\n formatUnits as formatUnits2,\n hexToString as hexToString2,\n trim as trim2\n} from \"viem\";\n\n// src/constants/abis.ts\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"uint256\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"decimals\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint8\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"name\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"string\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"symbol\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"string\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"totalSupply\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"bool\"\n }\n ]\n }\n];\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"uint256\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"decimals\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint8\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"name\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"symbol\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"totalSupply\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"bool\"\n }\n ]\n }\n];\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"bool\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"name\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"string\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"totalSupply\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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];\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\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\n// src/actions/contracts/fetchToken.ts\nimport {\n ContractFunctionExecutionError,\n formatUnits,\n hexToString,\n trim\n} from \"viem\";\nasync function fetchToken({\n address,\n chainId,\n formatUnits: unit = 18\n}) {\n async function fetchToken_({ abi }) {\n const erc20Config = { address, abi, chainId };\n const [decimals, name, symbol, totalSupply] = await readContracts({\n allowFailure: false,\n contracts: [\n { ...erc20Config, functionName: \"decimals\" },\n { ...erc20Config, functionName: \"name\" },\n { ...erc20Config, functionName: \"symbol\" },\n { ...erc20Config, functionName: \"totalSupply\" }\n ]\n });\n return {\n address,\n decimals,\n name,\n symbol,\n totalSupply: {\n formatted: formatUnits(totalSupply, getUnit(unit)),\n value: totalSupply\n }\n };\n }\n try {\n return await fetchToken_({ abi: erc20ABI });\n } catch (err) {\n if (err instanceof ContractFunctionExecutionError) {\n const { name, symbol, ...rest } = await fetchToken_({\n abi: erc20ABI_bytes32\n });\n return {\n name: hexToString(trim(name, { dir: \"right\" })),\n symbol: hexToString(trim(symbol, { dir: \"right\" })),\n ...rest\n };\n }\n throw err;\n }\n}\n\n// src/actions/viem/getPublicClient.ts\nfunction getPublicClient({ chainId } = {}) {\n const config2 = getConfig();\n if (chainId)\n return config2.getPublicClient({ chainId }) || config2.publicClient;\n return config2.publicClient;\n}\n\n// src/actions/viem/getWalletClient.ts\nasync function getWalletClient({\n chainId\n} = {}) {\n const config2 = getConfig();\n const walletClient = await config2.connector?.getWalletClient?.({ chainId }) || null;\n return walletClient;\n}\n\n// src/actions/viem/getWebSocketPublicClient.ts\nfunction getWebSocketPublicClient({\n chainId\n} = {}) {\n const config2 = getConfig();\n if (chainId)\n return config2.getWebSocketPublicClient({ chainId }) || config2.webSocketPublicClient;\n return config2.webSocketPublicClient;\n}\n\n// src/actions/viem/watchPublicClient.ts\nfunction watchPublicClient(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(getPublicClient(args));\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return unsubscribe;\n}\n\n// src/actions/viem/watchWalletClient.ts\nimport { shallow } from \"zustand/shallow\";\nfunction watchWalletClient({ chainId }, callback) {\n const config2 = getConfig();\n const handleChange = async ({ chainId: chainId_ }) => {\n if (chainId && chainId_ && chainId !== chainId_)\n return;\n const walletClient = await getWalletClient({ chainId });\n if (!getConfig().connector)\n return callback(null);\n return callback(walletClient);\n };\n const unsubscribe = config2.subscribe(\n ({ data, connector }) => ({\n account: data?.account,\n chainId: data?.chain?.id,\n connector\n }),\n handleChange,\n {\n equalityFn: shallow\n }\n );\n return unsubscribe;\n}\n\n// src/actions/viem/watchWebSocketPublicClient.ts\nfunction watchWebSocketPublicClient(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(getWebSocketPublicClient(args));\n const unsubscribe = config2.subscribe(\n ({ webSocketPublicClient }) => webSocketPublicClient,\n handleChange\n );\n return unsubscribe;\n}\n\n// src/actions/contracts/prepareWriteContract.ts\nasync function prepareWriteContract({\n abi,\n address,\n args,\n chainId,\n dataSuffix,\n functionName,\n walletClient: walletClient_,\n ...config2\n}) {\n const publicClient = getPublicClient({ chainId });\n const walletClient = walletClient_ ?? await getWalletClient({ chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (chainId)\n assertActiveChain({ chainId });\n const {\n account,\n accessList,\n blockNumber,\n blockTag,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n value\n } = getCallParameters(config2);\n const { result, request } = await publicClient.simulateContract({\n abi,\n address,\n functionName,\n args,\n account: account || walletClient.account,\n accessList,\n blockNumber,\n blockTag,\n dataSuffix,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n value\n });\n const minimizedAbi = abi.filter(\n (abiItem) => \"name\" in abiItem && abiItem.name === functionName\n );\n return {\n mode: \"prepared\",\n request: {\n ...request,\n abi: minimizedAbi,\n chainId\n },\n result\n };\n}\n\n// src/actions/contracts/getContract.ts\nimport { getContract as getContract_ } from \"viem\";\nfunction getContract({\n address,\n abi,\n chainId,\n walletClient\n}) {\n const publicClient = getPublicClient({ chainId });\n return getContract_({\n address,\n abi,\n publicClient,\n walletClient\n });\n}\n\n// src/actions/contracts/multicall.ts\nasync function multicall({\n chainId,\n contracts,\n blockNumber,\n blockTag,\n ...args\n}) {\n const publicClient = getPublicClient({ chainId });\n if (!publicClient.chains)\n throw new ConfigChainsNotFound();\n if (chainId && publicClient.chain.id !== chainId)\n throw new ChainNotConfiguredError({ chainId });\n return publicClient.multicall({\n allowFailure: args.allowFailure ?? true,\n blockNumber,\n blockTag,\n contracts\n });\n}\n\n// src/actions/contracts/readContract.ts\nasync function readContract({\n address,\n account,\n chainId,\n abi,\n args,\n functionName,\n blockNumber,\n blockTag\n}) {\n const publicClient = getPublicClient({ chainId });\n return publicClient.readContract({\n abi,\n address,\n account,\n functionName,\n args,\n blockNumber,\n blockTag\n });\n}\n\n// src/actions/contracts/readContracts.ts\nimport { ContractFunctionExecutionError as ContractFunctionExecutionError2 } from \"viem\";\nasync function readContracts({\n contracts,\n blockNumber,\n blockTag,\n ...args\n}) {\n const { allowFailure = true } = args;\n try {\n const publicClient = getPublicClient();\n const contractsByChainId = contracts.reduce((contracts2, contract, index) => {\n const chainId = contract.chainId ?? publicClient.chain.id;\n return {\n ...contracts2,\n [chainId]: [...contracts2[chainId] || [], { contract, index }]\n };\n }, {});\n const promises = () => Object.entries(contractsByChainId).map(\n ([chainId, contracts2]) => multicall({\n allowFailure,\n chainId: parseInt(chainId),\n contracts: contracts2.map(\n ({ contract }) => contract\n ),\n blockNumber,\n blockTag\n })\n );\n const multicallResults = (await Promise.all(promises())).flat();\n const resultIndexes = Object.values(contractsByChainId).flatMap(\n (contracts2) => contracts2.map(({ index }) => index)\n );\n return multicallResults.reduce((results, result, index) => {\n if (results)\n results[resultIndexes[index]] = result;\n return results;\n }, []);\n } catch (err) {\n if (err instanceof ContractFunctionExecutionError2)\n throw err;\n const promises = () => contracts.map(\n (contract) => readContract({ ...contract, blockNumber, blockTag })\n );\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: void 0, status: \"failure\" };\n });\n return await Promise.all(promises());\n }\n}\n\n// src/actions/contracts/watchContractEvent.ts\nimport { shallow as shallow2 } from \"zustand/shallow\";\nfunction watchContractEvent({\n address,\n abi,\n chainId,\n eventName\n}, callback) {\n let unwatch;\n const watchEvent = async () => {\n if (unwatch)\n unwatch();\n const publicClient = getWebSocketPublicClient({ chainId }) || getPublicClient({ chainId });\n unwatch = publicClient.watchContractEvent({\n address,\n abi,\n eventName,\n onLogs: callback\n });\n };\n watchEvent();\n const config2 = getConfig();\n const unsubscribe = config2.subscribe(\n ({ publicClient, webSocketPublicClient }) => ({\n publicClient,\n webSocketPublicClient\n }),\n watchEvent,\n { equalityFn: shallow2 }\n );\n return () => {\n unwatch?.();\n unsubscribe();\n };\n}\n\n// src/actions/network-status/watchBlockNumber.ts\nimport { shallow as shallow3 } from \"zustand/shallow\";\nfunction watchBlockNumber(args, callback) {\n let unwatch;\n const createListener = (publicClient) => {\n if (unwatch)\n unwatch();\n unwatch = publicClient.watchBlockNumber({\n onBlockNumber: callback,\n emitOnBegin: true,\n poll: true\n });\n };\n const publicClient_ = getWebSocketPublicClient({ chainId: args.chainId }) ?? getPublicClient({ chainId: args.chainId });\n if (args.listen)\n createListener(publicClient_);\n const config2 = getConfig();\n const unsubscribe = config2.subscribe(\n ({ publicClient, webSocketPublicClient }) => ({\n publicClient,\n webSocketPublicClient\n }),\n async ({ publicClient, webSocketPublicClient }) => {\n const publicClient_2 = webSocketPublicClient ?? publicClient;\n if (args.listen && !args.chainId && publicClient_2) {\n createListener(publicClient_2);\n }\n },\n {\n equalityFn: shallow3\n }\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/watchMulticall.ts\nfunction watchMulticall(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(await multicall(args));\n const unwatch = args.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : void 0;\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/watchReadContract.ts\nfunction watchReadContract(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(await readContract(args));\n const unwatch = args.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : void 0;\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/watchReadContracts.ts\nfunction watchReadContracts(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(await readContracts(args));\n const unwatch = args.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : void 0;\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/writeContract.ts\nasync function writeContract(config2) {\n const walletClient = await getWalletClient({ chainId: config2.chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (config2.chainId)\n assertActiveChain({ chainId: config2.chainId });\n let request;\n if (config2.mode === \"prepared\") {\n request = config2.request;\n } else {\n const { chainId: _, mode: __, ...args } = config2;\n const res = await prepareWriteContract(args);\n request = res.request;\n }\n const hash = await walletClient.writeContract({\n ...request,\n chain: config2.chainId ? { id: config2.chainId } : null\n });\n return { hash };\n}\n\n// src/actions/accounts/fetchBalance.ts\nasync function fetchBalance({\n address,\n chainId,\n formatUnits: unit,\n token\n}) {\n const config2 = getConfig();\n const publicClient = getPublicClient({ chainId });\n if (token) {\n const fetchContractBalance = async ({ abi }) => {\n const erc20Config = { abi, address: token, chainId };\n const [value2, decimals, symbol] = await readContracts({\n allowFailure: false,\n contracts: [\n {\n ...erc20Config,\n functionName: \"balanceOf\",\n args: [address]\n },\n { ...erc20Config, functionName: \"decimals\" },\n { ...erc20Config, functionName: \"symbol\" }\n ]\n });\n return {\n decimals,\n formatted: formatUnits2(value2 ?? \"0\", getUnit(unit ?? decimals)),\n symbol,\n value: value2\n };\n };\n try {\n return await fetchContractBalance({ abi: erc20ABI });\n } catch (err) {\n if (err instanceof ContractFunctionExecutionError3) {\n const { symbol, ...rest } = await fetchContractBalance({\n abi: erc20ABI_bytes32\n });\n return {\n symbol: hexToString2(trim2(symbol, { dir: \"right\" })),\n ...rest\n };\n }\n throw err;\n }\n }\n const chains = [\n ...config2.publicClient.chains || [],\n ...config2.chains ?? []\n ];\n const value = await publicClient.getBalance({ address });\n const chain = chains.find((x) => x.id === publicClient.chain.id);\n return {\n decimals: chain?.nativeCurrency.decimals ?? 18,\n formatted: formatUnits2(value ?? \"0\", getUnit(unit ?? 18)),\n symbol: chain?.nativeCurrency.symbol ?? \"ETH\",\n value\n };\n}\n\n// src/actions/accounts/getAccount.ts\nfunction getAccount() {\n const { data, connector, status } = getConfig();\n switch (status) {\n case \"connected\":\n return {\n address: data?.account,\n connector,\n isConnected: true,\n isConnecting: false,\n isDisconnected: false,\n isReconnecting: false,\n status\n };\n case \"reconnecting\":\n return {\n address: data?.account,\n connector,\n isConnected: !!data?.account,\n isConnecting: false,\n isDisconnected: false,\n isReconnecting: true,\n status\n };\n case \"connecting\":\n return {\n address: data?.account,\n connector,\n isConnected: false,\n isConnecting: true,\n isDisconnected: false,\n isReconnecting: false,\n status\n };\n case \"disconnected\":\n return {\n address: void 0,\n connector: void 0,\n isConnected: false,\n isConnecting: false,\n isDisconnected: true,\n isReconnecting: false,\n status\n };\n }\n}\n\n// src/actions/accounts/getNetwork.ts\nfunction getNetwork() {\n const config2 = getConfig();\n const chainId = config2.data?.chain?.id;\n const activeChains = config2.chains ?? [];\n const activeChain = [\n ...config2.publicClient?.chains || [],\n ...activeChains\n ].find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${chainId}`,\n network: `${chainId}`,\n nativeCurrency: { name: \"Ether\", decimals: 18, symbol: \"ETH\" },\n rpcUrls: {\n default: { http: [\"\"] },\n public: { http: [\"\"] }\n }\n };\n return {\n chain: chainId ? {\n ...activeChain,\n ...config2.data?.chain,\n id: chainId\n } : void 0,\n chains: activeChains\n };\n}\n\n// src/actions/accounts/signMessage.ts\nasync function signMessage(args) {\n const walletClient = await getWalletClient();\n if (!walletClient)\n throw new ConnectorNotFoundError();\n return await walletClient.signMessage({\n message: args.message\n });\n}\n\n// src/actions/accounts/signTypedData.ts\nasync function signTypedData({\n domain,\n message,\n primaryType,\n types\n}) {\n const walletClient = await getWalletClient();\n if (!walletClient)\n throw new ConnectorNotFoundError();\n const { chainId } = domain;\n if (chainId)\n assertActiveChain({ chainId });\n return walletClient.signTypedData({\n message,\n primaryType,\n types,\n domain\n });\n}\n\n// src/actions/accounts/switchNetwork.ts\nasync function switchNetwork({\n chainId\n}) {\n const { connector } = getConfig();\n if (!connector)\n throw new ConnectorNotFoundError();\n if (!connector.switchChain)\n throw new SwitchChainNotSupportedError({\n connector\n });\n return connector.switchChain(chainId);\n}\n\n// src/actions/accounts/watchAccount.ts\nimport { shallow as shallow4 } from \"zustand/shallow\";\nfunction watchAccount(callback, { selector = (x) => x } = {}) {\n const config2 = getConfig();\n const handleChange = () => callback(getAccount());\n const unsubscribe = config2.subscribe(\n ({ data, connector, status }) => selector({\n address: data?.account,\n connector,\n status\n }),\n handleChange,\n {\n equalityFn: shallow4\n }\n );\n return unsubscribe;\n}\n\n// src/actions/accounts/watchNetwork.ts\nimport { shallow as shallow5 } from \"zustand/shallow\";\nfunction watchNetwork(callback, { selector = (x) => x } = {}) {\n const config2 = getConfig();\n const handleChange = () => callback(getNetwork());\n const unsubscribe = config2.subscribe(\n ({ data, chains }) => selector({ chainId: data?.chain?.id, chains }),\n handleChange,\n {\n equalityFn: shallow5\n }\n );\n return unsubscribe;\n}\n\n// src/actions/ens/fetchEnsAddress.ts\nimport { getAddress } from \"viem\";\nasync function fetchEnsAddress({\n chainId,\n name\n}) {\n const { normalize } = await import(\"viem/ens\");\n const publicClient = getPublicClient({ chainId });\n const address = await publicClient.getEnsAddress({\n name: normalize(name)\n });\n try {\n if (address === \"0x0000000000000000000000000000000000000000\")\n return null;\n return address ? getAddress(address) : null;\n } catch (_error) {\n return null;\n }\n}\n\n// src/actions/ens/fetchEnsAvatar.ts\nasync function fetchEnsAvatar({\n name,\n chainId\n}) {\n const { normalize } = await import(\"viem/ens\");\n const publicClient = getPublicClient({ chainId });\n const avatar = await publicClient.getEnsAvatar({ name: normalize(name) });\n return avatar;\n}\n\n// src/actions/ens/fetchEnsName.ts\nimport { getAddress as getAddress2 } from \"viem\";\nasync function fetchEnsName({\n address,\n chainId\n}) {\n const publicClient = getPublicClient({ chainId });\n return publicClient.getEnsName({\n address: getAddress2(address)\n });\n}\n\n// src/actions/ens/fetchEnsResolver.ts\nasync function fetchEnsResolver({\n chainId,\n name\n}) {\n const { normalize } = await import(\"viem/ens\");\n const publicClient = getPublicClient({ chainId });\n const resolver = await publicClient.getEnsResolver({ name: normalize(name) });\n return resolver;\n}\n\n// src/actions/network-status/fetchBlockNumber.ts\nasync function fetchBlockNumber({\n chainId\n} = {}) {\n const publicClient = getPublicClient({ chainId });\n const blockNumber = await publicClient.getBlockNumber();\n return blockNumber;\n}\n\n// src/actions/network-status/fetchFeeData.ts\nimport { formatUnits as formatUnits3, parseGwei } from \"viem\";\nasync function fetchFeeData({\n chainId,\n formatUnits: units = \"gwei\"\n} = {}) {\n const publicClient = getPublicClient({ chainId });\n const block = await publicClient.getBlock();\n let gasPrice = null;\n try {\n gasPrice = await publicClient.getGasPrice();\n } catch {\n }\n let lastBaseFeePerGas = null;\n let maxFeePerGas = null;\n let maxPriorityFeePerGas = null;\n if (block?.baseFeePerGas) {\n lastBaseFeePerGas = block.baseFeePerGas;\n maxPriorityFeePerGas = parseGwei(\"1\");\n maxFeePerGas = block.baseFeePerGas * 2n + maxPriorityFeePerGas;\n }\n const unit = getUnit(units);\n const formatted = {\n gasPrice: gasPrice ? formatUnits3(gasPrice, unit) : null,\n maxFeePerGas: maxFeePerGas ? formatUnits3(maxFeePerGas, unit) : null,\n maxPriorityFeePerGas: maxPriorityFeePerGas ? formatUnits3(maxPriorityFeePerGas, unit) : null\n };\n return {\n lastBaseFeePerGas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n formatted\n };\n}\n\n// src/actions/transactions/fetchTransaction.ts\nasync function fetchTransaction({\n chainId,\n hash\n}) {\n const publicClient = getPublicClient({ chainId });\n return publicClient.getTransaction({ hash });\n}\n\n// src/actions/transactions/prepareSendTransaction.ts\nimport { isAddress } from \"viem\";\nasync function prepareSendTransaction({\n accessList,\n account,\n chainId,\n data,\n gas: gas_,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to: to_,\n value,\n walletClient: walletClient_\n}) {\n const publicClient = getPublicClient({ chainId });\n const walletClient = walletClient_ ?? await getWalletClient({ chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (chainId)\n assertActiveChain({ chainId });\n const to = (to_ && !isAddress(to_) ? await fetchEnsAddress({ name: to_ }) : to_) || void 0;\n if (to && !isAddress(to))\n throw new Error(\"Invalid address\");\n const gas = typeof gas_ === \"undefined\" ? await publicClient.estimateGas({\n accessList,\n account: walletClient.account,\n data,\n gas: gas_ ?? void 0,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value\n }) : gas_ || void 0;\n return {\n accessList,\n account,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n mode: \"prepared\",\n nonce,\n to,\n value,\n ...chainId ? { chainId } : {}\n };\n}\n\n// src/actions/transactions/sendTransaction.ts\nasync function sendTransaction({\n accessList,\n account,\n chainId,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n mode,\n nonce,\n to,\n value\n}) {\n const walletClient = await getWalletClient({ chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (chainId)\n assertActiveChain({ chainId });\n let args;\n if (mode === \"prepared\") {\n args = {\n account,\n accessList,\n chain: null,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value\n };\n } else {\n args = await prepareSendTransaction({\n accessList,\n account,\n chainId,\n data,\n gas: gas || null,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value\n });\n }\n const hash = await walletClient.sendTransaction({\n ...args,\n chain: chainId ? { id: chainId } : null\n });\n return { hash };\n}\n\n// src/actions/transactions/waitForTransaction.ts\nimport { hexToString as hexToString3 } from \"viem\";\nasync function waitForTransaction({\n chainId,\n confirmations = 1,\n hash,\n onReplaced,\n timeout = 0\n}) {\n const publicClient = getPublicClient({ chainId });\n const receipt = await publicClient.waitForTransactionReceipt({\n hash,\n confirmations,\n onReplaced,\n timeout\n });\n if (receipt.status === \"reverted\") {\n const txn = await publicClient.getTransaction({\n hash: receipt.transactionHash\n });\n const code = await publicClient.call({\n ...txn,\n gasPrice: txn.type !== \"eip1559\" ? txn.gasPrice : void 0,\n maxFeePerGas: txn.type === \"eip1559\" ? txn.maxFeePerGas : void 0,\n maxPriorityFeePerGas: txn.type === \"eip1559\" ? txn.maxPriorityFeePerGas : void 0\n });\n const reason = hexToString3(`0x${code.substring(138)}`);\n throw new Error(reason);\n }\n return receipt;\n}\n\n// src/actions/transactions/watchPendingTransactions.ts\nimport { shallow as shallow6 } from \"zustand/shallow\";\nfunction watchPendingTransactions(args, callback) {\n let unwatch;\n const createListener = (publicClient) => {\n if (unwatch)\n unwatch();\n unwatch = publicClient.watchPendingTransactions({\n onTransactions: callback,\n poll: true\n });\n };\n const publicClient_ = getWebSocketPublicClient({ chainId: args.chainId }) ?? getPublicClient({ chainId: args.chainId });\n createListener(publicClient_);\n const config2 = getConfig();\n const unsubscribe = config2.subscribe(\n ({ publicClient, webSocketPublicClient }) => ({\n publicClient,\n webSocketPublicClient\n }),\n async ({ publicClient, webSocketPublicClient }) => {\n const publicClient_2 = webSocketPublicClient ?? publicClient;\n if (!args.chainId && publicClient_2) {\n createListener(publicClient_2);\n }\n },\n {\n equalityFn: shallow6\n }\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/utils/assertActiveChain.ts\nfunction assertActiveChain({ chainId }) {\n const { chain: activeChain, chains } = getNetwork();\n const activeChainId = activeChain?.id;\n if (activeChainId && chainId !== activeChainId) {\n throw new ChainMismatchError({\n activeChain: chains.find((x) => x.id === activeChainId)?.name ?? `Chain ${activeChainId}`,\n targetChain: chains.find((x) => x.id === chainId)?.name ?? `Chain ${chainId}`\n });\n }\n}\n\nexport {\n configureChains,\n ChainMismatchError,\n ChainNotConfiguredError,\n ConnectorAlreadyConnectedError,\n ConfigChainsNotFound,\n SwitchChainNotSupportedError,\n ConnectorNotFoundError,\n deepEqual,\n deserialize,\n getCallParameters,\n getSendTransactionParameters,\n getUnit,\n serialize,\n noopStorage,\n createStorage,\n Config,\n createConfig,\n getConfig,\n connect,\n disconnect,\n erc20ABI,\n erc721ABI,\n erc4626ABI,\n fetchToken,\n getPublicClient,\n getWalletClient,\n getWebSocketPublicClient,\n watchPublicClient,\n watchWalletClient,\n watchWebSocketPublicClient,\n prepareWriteContract,\n getContract,\n multicall,\n readContract,\n readContracts,\n watchContractEvent,\n watchBlockNumber,\n watchMulticall,\n watchReadContract,\n watchReadContracts,\n writeContract,\n fetchBalance,\n getAccount,\n getNetwork,\n signMessage,\n signTypedData,\n switchNetwork,\n watchAccount,\n watchNetwork,\n fetchEnsAddress,\n fetchEnsAvatar,\n fetchEnsName,\n fetchEnsResolver,\n fetchBlockNumber,\n fetchFeeData,\n fetchTransaction,\n prepareSendTransaction,\n sendTransaction,\n waitForTransaction,\n watchPendingTransactions\n};\n","import { MockProvider, MockProviderOptions } from '@wagmi/connectors/mock';\nimport { Connector, ConnectorData, WalletClient } from '@wagmi/core';\nimport { createWalletClient, getAddress, Hex, http, zeroAddress } from 'viem';\nimport type { Chain } from 'viem/chains';\nimport { mainnet } from 'viem/chains';\n\nexport function normalizeChainId(chainId: string | number | bigint) {\n if (typeof chainId === 'string')\n return Number.parseInt(\n chainId,\n chainId.trim().substring(0, 2) === '0x' ? 16 : 10,\n );\n if (typeof chainId === 'bigint') return Number(chainId);\n return chainId;\n}\n\ntype MockConnectorOptions = Omit<\n MockProviderOptions,\n 'chainId' | 'walletClient'\n> & {\n chainId?: number;\n};\n\nexport class ImpersonatedConnector extends Connector<\n MockProvider,\n MockConnectorOptions\n> {\n readonly id = 'impersonated';\n readonly name = 'Impersonated';\n readonly ready = true;\n private accountAddress: Hex;\n\n #provider?: MockProvider;\n\n constructor({\n chains,\n options,\n }: {\n chains?: Chain[];\n options: MockConnectorOptions;\n }) {\n super({\n chains,\n options: {\n ...options,\n chainId: options.chainId ?? chains?.[0]?.id,\n },\n });\n this.accountAddress = zeroAddress;\n }\n\n setAccountAddress(address: Hex | undefined) {\n this.accountAddress = address || zeroAddress;\n }\n\n async connect({ chainId }: { address?: Hex; chainId?: number } = {}) {\n const provider = await this.getProvider({\n address: this.accountAddress,\n chainId,\n });\n provider.on('accountsChanged', this.onAccountsChanged);\n provider.on('chainChanged', this.onChainChanged);\n provider.on('disconnect', this.onDisconnect);\n\n this.emit('message', { type: 'connecting' });\n\n const accounts = await provider.enable();\n const account = getAddress(accounts[0] as string);\n const id = normalizeChainId(provider.chainId);\n const unsupported = this.isChainUnsupported(id);\n const data = { account, chain: { id, unsupported }, provider };\n\n if (!this.options.flags?.noSwitchChain)\n this.switchChain = this.#switchChain;\n\n return new Promise>((res) =>\n setTimeout(() => res(data), 100),\n );\n }\n\n async disconnect() {\n const provider = await this.getProvider();\n await provider.disconnect();\n\n provider.removeListener('accountsChanged', this.onAccountsChanged);\n provider.removeListener('chainChanged', this.onChainChanged);\n provider.removeListener('disconnect', this.onDisconnect);\n }\n\n async getAccount() {\n const provider = await this.getProvider();\n const accounts = await provider.getAccounts();\n const account = accounts[0];\n if (!account) throw new Error('Failed to get account');\n // return checksum address\n return getAddress(account);\n }\n\n async getChainId() {\n const provider = await this.getProvider();\n return normalizeChainId(provider.chainId);\n }\n\n async getProvider({\n address,\n chainId,\n }: { address?: Hex; chainId?: number } = {}) {\n console.log('address', address);\n if (!this.#provider || chainId)\n this.#provider = new MockProvider({\n ...this.options,\n chainId: chainId ?? this.options.chainId ?? this.chains[0]!.id,\n walletClient: createWalletClient({\n account: address || zeroAddress,\n chain: this.chains.find((chain) => chain.id === chainId) || mainnet,\n transport: http(),\n }),\n });\n return this.#provider;\n }\n\n async getWalletClient(): Promise {\n const provider = await this.getProvider();\n return provider.getWalletClient();\n }\n\n async isAuthorized() {\n try {\n const provider = await this.getProvider();\n const account = await provider.getAccounts();\n return this.options.flags?.isAuthorized ?? !!account;\n } catch {\n return false;\n }\n }\n\n async #switchChain(chainId: number) {\n const provider = await this.getProvider();\n await provider.switchChain(chainId);\n return (\n this.chains.find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${chainId}`,\n network: `${chainId}`,\n nativeCurrency: { name: 'Ether', decimals: 18, symbol: 'ETH' },\n rpcUrls: { default: { http: [''] }, public: { http: [''] } },\n }\n );\n }\n\n async watchAsset(asset: {\n address: string;\n decimals?: number;\n image?: string;\n symbol: string;\n }) {\n const provider = await this.getProvider();\n return provider.watchAsset(asset);\n }\n\n protected onAccountsChanged = (accounts: string[]) => {\n if (accounts.length === 0) this.emit('disconnect');\n else this.emit('change', { account: getAddress(accounts[0] as string) });\n };\n\n protected onChainChanged = (chainId: number | string) => {\n const id = normalizeChainId(chainId);\n const unsupported = this.isChainUnsupported(id);\n this.emit('change', { chain: { id, unsupported } });\n };\n\n protected onDisconnect = () => {\n this.emit('disconnect');\n };\n\n toJSON() {\n return '';\n }\n}\n","import {\n configureChains,\n createConfig,\n GetAccountResult,\n watchAccount,\n watchNetwork,\n} from '@wagmi/core';\nimport React, { useEffect, useState } from 'react';\nimport { Chain } from 'viem';\nimport { publicProvider } from 'wagmi/providers/public';\nimport { StoreApi, UseBoundStore } from 'zustand';\n\nimport {\n AllConnectorsInitProps,\n ConnectorType,\n initAllConnectors,\n} from '../connectors';\n\ninterface WagmiProviderProps {\n useStore: UseBoundStore<\n StoreApi<{\n changeActiveWalletAccount: (account?: GetAccountResult) => Promise;\n changeActiveWalletChain: (chain?: Chain) => Promise;\n setConnectors: (connectors: ConnectorType[]) => void;\n }>\n >;\n connectorsInitProps: AllConnectorsInitProps;\n}\n\nfunction Child({\n useStore,\n connectors,\n}: Omit & {\n connectors: ConnectorType[];\n}) {\n const { setConnectors, changeActiveWalletAccount, changeActiveWalletChain } =\n useStore();\n\n watchAccount(async (data) => {\n if (data.address) {\n await changeActiveWalletAccount(data);\n }\n });\n watchNetwork(async (data) => {\n if (data.chain?.id) {\n await changeActiveWalletChain(data.chain);\n }\n });\n\n useEffect(() => {\n if (connectors) {\n setConnectors(connectors);\n }\n }, [connectors]);\n\n return null;\n}\n\nexport function WagmiProvider({\n useStore,\n connectorsInitProps,\n}: WagmiProviderProps) {\n const [connectors] = useState(initAllConnectors(connectorsInitProps));\n const [mappedConnectors] = useState(\n connectors.map((connector) => connector),\n );\n\n const { publicClient } = configureChains(\n Object.values(connectorsInitProps.chains),\n [publicProvider()],\n );\n\n createConfig({\n autoConnect: false,\n publicClient,\n connectors,\n });\n\n return ;\n}\n","import { Draft, produce } from 'immer';\nimport { Hex, PublicClient } from 'viem';\n\nimport { StoreSlice } from '../../types/store';\nimport {\n getLocalStorageTxPool,\n setLocalStorageTxPool,\n} from '../../utils/localStorage';\nimport { EthereumAdapter } from '../adapters/EthereumAdapter';\nimport {\n GelatoAdapter,\n GelatoTx,\n GelatoTXState,\n isGelatoBaseTx,\n isGelatoBaseTxWithoutTimestamp,\n isGelatoTx,\n} from '../adapters/GelatoAdapter';\nimport { GnosisAdapter } from '../adapters/GnosisAdapter';\nimport { AdapterInterface } from '../adapters/interface';\nimport { WalletType } from '../connectors';\nimport { IWalletSlice } from './walletSlice';\n\nexport type BaseTx = EthBaseTx | GelatoBaseTx;\n\nexport type InitialTx = Hex | GelatoTx;\nexport type NewTx = { hash: Hex } | GelatoTx;\n\ntype BasicTx = {\n chainId: number;\n type: string;\n from: Hex;\n payload?: object;\n localTimestamp: number;\n timestamp?: number;\n errorMessage?: string;\n};\n\nexport type EthBaseTx = BasicTx & {\n hash: Hex;\n to: Hex;\n nonce: number;\n};\n\nexport type GelatoBaseTx = BasicTx & {\n taskId: string;\n hash?: Hex;\n gelatoStatus?: GelatoTXState;\n};\n\nexport type ClientsRecord = Record;\n\nexport type TransactionsSliceBaseType = {\n clients: ClientsRecord;\n setClient: (chainId: number, client: PublicClient) => void;\n initTxPool: () => void;\n updateEthAdapter: (gnosis: boolean) => void;\n};\n\nexport type TransactionPool = Record;\n\ntype PoolTx = T & {\n status?: number;\n pending: boolean;\n walletType: WalletType;\n};\n\nexport interface ITransactionsState {\n transactionsPool: TransactionPool>;\n transactionsIntervalsMap: Record;\n}\n\nexport interface ITransactionsActions {\n gelatoAdapter: AdapterInterface;\n ethereumAdapter: AdapterInterface;\n txStatusChangedCallback: (\n data: T & {\n status?: number;\n timestamp?: number;\n },\n ) => void;\n executeTx: (params: {\n body: () => Promise;\n params: {\n type: T['type'];\n payload: T['payload'];\n desiredChainID: number;\n };\n }) => Promise<\n T & {\n status?: number;\n pending: boolean;\n }\n >;\n addTXToPool: (\n tx:\n | Omit\n | Omit,\n activeWallet: WalletType,\n ) => TransactionPool>;\n isGelatoAvailable: boolean;\n checkIsGelatoAvailable: (chainId: number) => Promise;\n updateEthAdapter: (gnosis: boolean) => void;\n}\n\nexport type ITransactionsSlice = ITransactionsActions &\n ITransactionsState &\n TransactionsSliceBaseType;\n\nexport function createTransactionsSlice({\n txStatusChangedCallback,\n defaultClients,\n}: {\n txStatusChangedCallback: (tx: T) => void;\n defaultClients: ClientsRecord;\n}): StoreSlice<\n ITransactionsSlice,\n Pick\n> {\n return (set, get) => ({\n transactionsPool: {},\n transactionsIntervalsMap: {},\n clients: defaultClients,\n txStatusChangedCallback,\n gelatoAdapter: new GelatoAdapter(get, set), // TODO: think when to init, maybe only when working with gelato or it's available\n ethereumAdapter: new EthereumAdapter(get, set), // This might be a Gnosis Safe adapter, re-inits when wallet.type === GnosisSafe\n executeTx: async ({ body, params }) => {\n await get().checkAndSwitchNetwork(params.desiredChainID);\n const activeWallet = get().activeWallet;\n if (!activeWallet) {\n throw new Error('No wallet connected');\n }\n\n const chainId = Number(params.desiredChainID);\n\n const tx: InitialTx = await body();\n const args = {\n tx: isGelatoTx(tx) ? tx : { hash: tx },\n payload: params.payload,\n activeWallet,\n chainId,\n type: params.type,\n };\n\n return isGelatoTx(tx) // in case of gnosis safe it works in a same way\n ? get().gelatoAdapter.executeTx(args)\n : get().ethereumAdapter.executeTx(args);\n },\n\n addTXToPool: (transaction, walletType) => {\n const localTimestamp = new Date().getTime();\n if (isGelatoBaseTxWithoutTimestamp(transaction)) {\n set((state) =>\n produce(state, (draft) => {\n draft.transactionsPool[transaction.taskId] = {\n ...transaction,\n pending: true,\n walletType,\n localTimestamp,\n } as Draft<\n T & {\n pending: boolean;\n walletType: WalletType;\n localTimestamp: number;\n }\n >;\n }),\n );\n\n const txPool = get().transactionsPool;\n setLocalStorageTxPool(txPool);\n } else {\n set((state) =>\n produce(state, (draft) => {\n draft.transactionsPool[transaction.hash] = {\n ...transaction,\n pending: true,\n walletType,\n localTimestamp,\n } as Draft<\n T & {\n pending: boolean;\n walletType: WalletType;\n }\n >;\n }),\n );\n }\n const txPool = get().transactionsPool;\n setLocalStorageTxPool(txPool);\n return txPool;\n },\n\n initTxPool: () => {\n const localStorageTXPool = getLocalStorageTxPool();\n if (localStorageTXPool) {\n const transactionsPool = JSON.parse(localStorageTXPool);\n // TODO: figure out type casting from string via ZOD or similar\n set(() => ({\n transactionsPool,\n }));\n }\n Object.values(get().transactionsPool).forEach((tx) => {\n if (tx.pending) {\n if (isGelatoBaseTx(tx)) {\n get().gelatoAdapter.startTxTracking(tx.taskId);\n } else {\n if (tx.hash) {\n get().ethereumAdapter.startTxTracking(tx.hash);\n }\n }\n }\n });\n },\n\n setClient: (chainId, client) => {\n const stateClients = get().clients;\n const updatedClients = (stateClients[chainId] = client);\n set({ clients: updatedClients });\n },\n\n isGelatoAvailable: true,\n checkIsGelatoAvailable: async (chainId) => {\n try {\n const response = await fetch(`https://relay.gelato.digital/relays/v2`);\n if (!response.ok) {\n set({ isGelatoAvailable: false });\n } else {\n const listOfRelays = (await response.json()) as { relays: string[] };\n const isRelayAvailable = !!listOfRelays.relays.find(\n (id) => +id === chainId,\n );\n set({ isGelatoAvailable: isRelayAvailable });\n }\n } catch (e) {\n set({ isGelatoAvailable: false });\n console.error(e);\n }\n },\n updateEthAdapter: (gnosis: boolean) => {\n set((state) =>\n produce(state, (draft) => {\n draft.ethereumAdapter = gnosis\n ? new GnosisAdapter(get, set)\n : new EthereumAdapter(get, set);\n }),\n );\n },\n });\n}\n","import { produce } from 'immer';\nimport { GetTransactionReturnType, Hex, PublicClient } from 'viem';\n\nimport { setLocalStorageTxPool } from '../../utils/localStorage';\nimport { BaseTx, ITransactionsSlice, NewTx } from '../store/transactionsSlice';\nimport { Wallet } from '../store/walletSlice';\nimport { AdapterInterface } from './interface';\n\nexport class EthereumAdapter implements AdapterInterface {\n get: () => ITransactionsSlice;\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void;\n transactionsIntervalsMap: Record = {};\n\n constructor(\n get: () => ITransactionsSlice,\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void,\n ) {\n this.get = get;\n this.set = set;\n }\n\n executeTx = async (params: {\n tx: NewTx;\n activeWallet: Wallet;\n payload: object | undefined;\n chainId: number;\n type: T['type'];\n }): Promise => {\n const { activeWallet, chainId, type } = params;\n const tx = params.tx as GetTransactionReturnType;\n\n // ethereum tx\n const transaction = {\n chainId,\n hash: tx.hash,\n type,\n payload: params.payload,\n from: tx.from,\n to: tx.to as Hex,\n nonce: tx.nonce,\n };\n const txPool = this.get().addTXToPool(transaction, activeWallet.walletType);\n this.waitForTxReceipt(tx, tx.hash);\n return txPool[tx.hash];\n };\n startTxTracking = async (txKey: string) => {\n const retryCount = 5;\n const txData = this.get().transactionsPool[txKey];\n if (txData) {\n const client = this.get().clients[txData.chainId] as PublicClient;\n\n if (txData.hash) {\n // Find the transaction in the waiting pool\n for (let i = 0; i < retryCount; i++) {\n const tx = await client.getTransaction({ hash: txData.hash });\n // If the transaction is found, wait for the receipt\n if (tx) {\n await this.waitForTxReceipt(tx, txData.hash);\n return; // Exit the function if successful\n }\n }\n // Wait before the next retry\n await new Promise((resolve) => setTimeout(resolve, 3000));\n }\n } else {\n // TODO: no transaction in waiting pool\n }\n };\n\n private waitForTxReceipt = async (\n tx: GetTransactionReturnType,\n txHash: Hex,\n ) => {\n const chainId = tx.chainId || this.get().transactionsPool[txHash].chainId;\n const client = this.get().clients[chainId] as PublicClient;\n\n try {\n // TODO: need added onReplaced logic\n const txn = await client.waitForTransactionReceipt({ hash: tx.hash });\n this.updateTXStatus(txHash, txn.status);\n\n const updatedTX = this.get().transactionsPool[txHash];\n const txBlock = await client.getBlock({ blockNumber: txn.blockNumber });\n const timestamp = txBlock.timestamp;\n this.get().txStatusChangedCallback({\n ...updatedTX,\n timestamp,\n });\n } catch (e) {\n console.error(e);\n }\n };\n\n private updateTXStatus = (hash: string, status?: 'success' | 'reverted') => {\n this.set((state) =>\n produce(state, (draft) => {\n draft.transactionsPool[hash].status =\n status === 'success'\n ? 1\n : draft.transactionsPool[hash].pending\n ? undefined\n : 0;\n draft.transactionsPool[hash].pending = false;\n }),\n );\n setLocalStorageTxPool(this.get().transactionsPool);\n };\n}\n","import dayjs from 'dayjs';\nimport { produce } from 'immer';\nimport { GetTransactionReturnType, Hex } from 'viem';\n\nimport { SafeTransactionServiceUrls } from '../../utils/constants';\nimport { setLocalStorageTxPool } from '../../utils/localStorage';\nimport {\n BaseTx,\n EthBaseTx,\n ITransactionsSlice,\n NewTx,\n} from '../store/transactionsSlice';\nimport { Wallet } from '../store/walletSlice';\nimport { AdapterInterface } from './interface';\n\nexport type GnosisTxStatusResponse = {\n transactionHash: string;\n safeTxHash: string;\n isExecuted: boolean;\n isSuccessful: boolean | null;\n executionDate: string | null;\n submissionDate: string | null;\n modified: string;\n nonce: number;\n};\n\nexport class GnosisAdapter implements AdapterInterface {\n get: () => ITransactionsSlice;\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void;\n transactionsIntervalsMap: Record = {};\n\n constructor(\n get: () => ITransactionsSlice,\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void,\n ) {\n this.get = get;\n this.set = set;\n }\n\n executeTx = async (params: {\n tx: NewTx;\n activeWallet: Wallet;\n payload: object | undefined;\n chainId: number;\n type: T['type'];\n }): Promise => {\n const { activeWallet, chainId, type } = params;\n const tx = params.tx as GetTransactionReturnType;\n // ethereum tx\n const transaction = {\n chainId,\n hash: tx.hash,\n type,\n payload: params.payload,\n from: tx.from,\n to: tx.to as Hex,\n nonce: tx.nonce,\n };\n const txPool = this.get().addTXToPool(transaction, activeWallet.walletType);\n this.startTxTracking(tx.hash);\n return txPool[tx.hash];\n };\n\n startTxTracking = async (txKey: string) => {\n const tx = this.get().transactionsPool[txKey];\n const isPending = tx.pending;\n if (!isPending) {\n return;\n }\n this.stopPollingGnosisTXStatus(txKey);\n\n const newGnosisInterval = setInterval(() => {\n this.fetchGnosisTxStatus(txKey);\n // TODO: maybe change timeout or even stop tracking after some time (day/week)\n }, 10000);\n\n this.transactionsIntervalsMap[txKey] = Number(newGnosisInterval);\n };\n\n private fetchGnosisTxStatus = async (txKey: string) => {\n const tx = this.get().transactionsPool[txKey];\n const response = await fetch(\n `${\n SafeTransactionServiceUrls[tx.chainId]\n }/multisig-transactions/${txKey}/`,\n );\n if (!response.ok) {\n // TODO: handle error if need, for now just skipping and do nothing with failed response\n } else {\n const gnosisStatus = (await response.json()) as GnosisTxStatusResponse;\n const gnosisStatusModified = dayjs(gnosisStatus.modified);\n const currentTime = dayjs();\n // check if more than a day passed to stop polling\n const daysPassed = currentTime.diff(gnosisStatusModified, 'day');\n if (daysPassed >= 1) {\n this.updateGnosisTxStatus(txKey, gnosisStatus, true);\n this.stopPollingGnosisTXStatus(txKey);\n this.get().txStatusChangedCallback(tx);\n return;\n }\n\n const isPending = !gnosisStatus.isExecuted;\n this.updateGnosisTxStatus(txKey, gnosisStatus);\n if (!isPending) {\n this.stopPollingGnosisTXStatus(txKey);\n this.get().txStatusChangedCallback(tx);\n }\n }\n };\n\n private stopPollingGnosisTXStatus = (txKey: string) => {\n const currentInterval = this.transactionsIntervalsMap[txKey];\n clearInterval(currentInterval);\n this.transactionsIntervalsMap[txKey] = undefined;\n };\n\n private updateGnosisTxStatus = (\n txKey: string,\n statusResponse: GnosisTxStatusResponse,\n forceStopped?: boolean,\n ) => {\n this.set((state) =>\n produce(state, (draft) => {\n const tx = draft.transactionsPool[txKey] as EthBaseTx & {\n pending: boolean;\n status?: number;\n };\n tx.status = forceStopped ? 0 : +!!statusResponse.isSuccessful; // turns boolean | null to 0 or 1\n tx.pending = forceStopped ? false : !statusResponse.isExecuted;\n tx.nonce = statusResponse.nonce;\n }),\n );\n setLocalStorageTxPool(this.get().transactionsPool);\n };\n}\n","// TODO: need add logic for mock connector\n\nimport {\n connect,\n disconnect,\n getAccount,\n GetAccountResult,\n getNetwork,\n getPublicClient,\n getWalletClient,\n} from '@wagmi/core';\nimport { produce } from 'immer';\nimport { Chain, Hex, PublicClient, WalletClient } from 'viem';\n\nimport { StoreSlice } from '../../types/store';\nimport {\n clearWalletConnectV2LocalStorage,\n clearWalletLinkLocalStorage,\n deleteLocalStorageWallet,\n LocalStorageKeys,\n setLocalStorageWallet,\n} from '../../utils/localStorage';\nimport { ConnectorType, getConnectorName, WalletType } from '../connectors';\nimport { ImpersonatedConnector } from '../connectors/ImpersonatedConnector';\nimport { TransactionsSliceBaseType } from './transactionsSlice';\n\nexport interface Wallet {\n walletType: WalletType;\n address: Hex;\n chain?: Chain;\n client: PublicClient;\n walletClient: WalletClient;\n // isActive is added, because Wallet can be connected but not active, i.e. wrong network\n isActive: boolean;\n // isContractAddress is added, to check if wallet address is contract\n isContractAddress: boolean;\n}\n\nexport type IWalletSlice = {\n isContractWalletRecord: Record;\n activeWallet?: Wallet;\n setActiveWallet: (\n wallet: Omit,\n ) => Promise;\n isActiveWalletSetting: boolean;\n connectWallet: (walletType: WalletType) => Promise;\n disconnectActiveWallet: () => Promise;\n walletActivating: boolean;\n walletConnectionError: string;\n resetWalletConnectionError: () => void;\n initDefaultWallet: () => Promise;\n changeActiveWalletAccount: (account?: GetAccountResult) => Promise;\n isActiveWalletAccountChanging: boolean;\n changeActiveWalletChain: (chain?: Chain) => Promise;\n isActiveWalletChainChanging: boolean;\n checkAndSwitchNetwork: (chainId?: number) => Promise;\n connectors: ConnectorType[];\n setConnectors: (connectors: ConnectorType[]) => void;\n _impersonatedAddress?: Hex;\n setImpersonatedAddress: (address: Hex) => void;\n checkIsContractWallet: (\n wallet: Omit,\n ) => Promise;\n};\n\nexport function createWalletSlice({\n walletConnected,\n}: {\n walletConnected: (wallet: Wallet) => void;\n}): StoreSlice {\n return (set, get) => ({\n isContractWalletRecord: {},\n walletActivating: false,\n walletConnectionError: '',\n connectors: [],\n setConnectors: async (connectors) => {\n if (get().connectors.length !== connectors.length) {\n set(() => ({ connectors }));\n await get().initDefaultWallet();\n get().initTxPool();\n }\n },\n initDefaultWallet: async () => {\n const lastConnectedWallet = localStorage.getItem(\n LocalStorageKeys.LastConnectedWallet,\n ) as WalletType | undefined;\n\n if (lastConnectedWallet) {\n await get().connectWallet(lastConnectedWallet);\n }\n },\n\n setActiveWallet: async (wallet) => {\n if (wallet.isActive) {\n if (wallet.chain) {\n set({ isActiveWalletSetting: true });\n const client = getPublicClient({ chainId: wallet.chain.id });\n const walletClient = await getWalletClient({\n chainId: wallet.chain.id,\n });\n\n if (client && walletClient) {\n const walletWithClients = {\n ...wallet,\n walletClient,\n client,\n };\n\n const isContractAddress =\n await get().checkIsContractWallet(walletWithClients);\n const activeWallet = { ...walletWithClients, isContractAddress };\n\n set({ activeWallet });\n walletConnected(activeWallet);\n set({ isActiveWalletSetting: false });\n }\n }\n }\n },\n isActiveWalletSetting: false,\n\n connectWallet: async (walletType) => {\n clearWalletLinkLocalStorage();\n clearWalletConnectV2LocalStorage();\n\n if (get().activeWallet?.walletType !== walletType) {\n await get().disconnectActiveWallet();\n }\n\n set({ walletActivating: true });\n set({ walletConnectionError: '' });\n\n const connector = get().connectors.find(\n (connector) => getConnectorName(connector) === walletType,\n );\n\n try {\n if (connector) {\n if (connector instanceof ImpersonatedConnector) {\n connector.setAccountAddress(get()._impersonatedAddress);\n await connect({ connector });\n } else {\n await connect({ connector });\n }\n\n setLocalStorageWallet(walletType);\n get().updateEthAdapter(walletType === 'GnosisSafe');\n\n const account = getAccount();\n const network = getNetwork();\n if (\n account &&\n account.isConnected &&\n account.address &&\n network.chain\n ) {\n await get().setActiveWallet({\n walletType,\n address: account.address,\n chain: network.chain,\n isActive: account.isConnected,\n isContractAddress: false,\n });\n }\n }\n } catch (e) {\n if (e instanceof Error) {\n let errorMessage = e.message ? e.message.toString() : e.toString();\n set({\n walletConnectionError: errorMessage,\n });\n }\n console.error(e);\n }\n set({ walletActivating: false });\n },\n checkAndSwitchNetwork: async (chainId) => {\n const activeWallet = get().activeWallet;\n if (\n chainId &&\n activeWallet &&\n activeWallet.chain?.id &&\n activeWallet.chain.id !== chainId\n ) {\n set({ isActiveWalletSetting: true });\n await activeWallet.walletClient.switchChain({\n id: chainId,\n });\n await new Promise((resolve) => {\n function loop() {\n if (!get().isActiveWalletSetting) {\n return resolve(() =>\n console.info('Chain for wallet client changed'),\n );\n }\n setTimeout(loop, 10);\n }\n loop();\n });\n }\n },\n disconnectActiveWallet: async () => {\n await disconnect();\n set({ activeWallet: undefined });\n deleteLocalStorageWallet();\n clearWalletLinkLocalStorage();\n clearWalletConnectV2LocalStorage();\n },\n\n checkIsContractWallet: async (wallet) => {\n const address = wallet.address;\n const walletRecord = get().isContractWalletRecord[address];\n if (walletRecord !== undefined) {\n return walletRecord;\n }\n const codeOfWalletAddress = await wallet.client.getBytecode({\n address: wallet.address,\n });\n const isContractWallet = !!codeOfWalletAddress;\n set((state) =>\n produce(state, (draft) => {\n draft.isContractWalletRecord[address] = isContractWallet;\n }),\n );\n return isContractWallet;\n },\n\n changeActiveWalletAccount: async (account) => {\n const activeWallet = get().activeWallet;\n if (\n account &&\n account.address &&\n activeWallet &&\n activeWallet.isActive &&\n activeWallet.address !== account.address &&\n !get().isActiveWalletAccountChanging\n ) {\n set({ isActiveWalletAccountChanging: true });\n await get().setActiveWallet({\n walletType: activeWallet.walletType,\n address: account.address,\n isActive: activeWallet.isActive,\n isContractAddress: activeWallet.isContractAddress,\n chain: activeWallet.chain,\n });\n set({ isActiveWalletAccountChanging: false });\n }\n },\n isActiveWalletAccountChanging: false,\n changeActiveWalletChain: async (chain) => {\n const activeWallet = get().activeWallet;\n if (\n chain !== undefined &&\n activeWallet &&\n activeWallet.isActive &&\n activeWallet.chain &&\n activeWallet.chain.id !== chain.id &&\n !get().isActiveWalletChainChanging\n ) {\n set({ isActiveWalletChainChanging: true });\n await get().setActiveWallet({\n walletType: activeWallet.walletType,\n address: activeWallet.address,\n isActive: activeWallet.isActive,\n isContractAddress: activeWallet.isContractAddress,\n chain: chain,\n });\n set({ isActiveWalletChainChanging: false });\n }\n },\n isActiveWalletChainChanging: false,\n\n setImpersonatedAddress: (address) => {\n set({ _impersonatedAddress: address });\n },\n resetWalletConnectionError: () => {\n set({ walletConnectionError: '' });\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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AwB,CAAC,YAAY;AACnC,UAAI,EAAE,sBAAsB,QAAQ,CAAC;AAAA,IACvC;AAAA,IACA,4BAA4B,MAAM;AAChC,UAAI,EAAE,uBAAuB,GAAG,CAAC;AAAA,IACnC;AAAA,EACF;AACF;","names":["module","EventEmitter","LocalStorageKeys","isEqual","import_chains","import_chains","import_injected","import_chains","EventEmitter","import_viem","import_eventemitter3","EventEmitter","import_viem","_provider","provider","__accessCheck","__privateGet","__privateAdd","__privateSet","__privateMethod","import_viem","import_viem","import_shallow","__privateAdd","status","__privateSet","__privateMethod","__privateGet","status","status","shallow4","shallow5","import_viem","import_chains","normalizeChainId","coinbase","import_react","React","import_immer","import_immer","status","import_immer","dayjs","txPool","import_immer","connector"]} \ No newline at end of file +{"version":3,"sources":["../node_modules/eventemitter3/index.js","../src/index.tsx","../src/hooks/useLastTxLocalStatus.tsx","../src/web3/adapters/GelatoAdapter.ts","../src/utils/localStorage.ts","../src/web3/store/transactionsSelectors.ts","../src/utils/chainInfoHelpers.ts","../src/utils/constants.ts","../src/utils/wallets/wallets/alphawallet.ts","../src/utils/wallets/wallets/atoken.ts","../src/utils/wallets/wallets/binance.ts","../src/utils/wallets/wallets/bitkeep.ts","../src/utils/wallets/wallets/bitpie.ts","../src/utils/wallets/wallets/bitski.ts","../src/utils/wallets/wallets/blockwallet.ts","../src/utils/wallets/wallets/brave.ts","../src/utils/wallets/wallets/coinbase.ts","../src/utils/wallets/wallets/core.ts","../src/utils/wallets/wallets/dcent.ts","../src/utils/wallets/wallets/defiwallet.ts","../src/utils/wallets/wallets/enkrypt.ts","../src/utils/wallets/wallets/exodus.ts","../src/utils/wallets/wallets/frame.ts","../src/utils/wallets/wallets/frontier.ts","../src/utils/wallets/wallets/gamestop.ts","../src/utils/wallets/wallets/huobiwallet.ts","../src/utils/wallets/wallets/hyperpay.ts","../src/utils/wallets/wallets/imtoken.ts","../src/utils/wallets/wallets/liquality.ts","../src/utils/wallets/wallets/mathwallet.ts","../src/utils/wallets/wallets/meetone.ts","../src/utils/wallets/wallets/metamask.ts","../src/utils/wallets/wallets/mykey.ts","../src/utils/wallets/wallets/okxwallet.ts","../src/utils/wallets/wallets/oneInch.ts","../src/utils/wallets/wallets/opera.ts","../src/utils/wallets/wallets/ownbit.ts","../src/utils/wallets/wallets/phantom.ts","../src/utils/wallets/wallets/rabby.ts","../src/utils/wallets/wallets/rainbow.ts","../src/utils/wallets/wallets/safepal.ts","../src/utils/wallets/wallets/sequence.ts","../src/utils/wallets/wallets/status.ts","../src/utils/wallets/wallets/tallywallet.ts","../src/utils/wallets/wallets/tokenary.ts","../src/utils/wallets/wallets/tokenpocket.ts","../src/utils/wallets/wallets/tp.ts","../src/utils/wallets/wallets/trust.ts","../src/utils/wallets/wallets/walletio.ts","../src/utils/wallets/wallets/xdefi.ts","../src/utils/wallets/wallets/zeal.ts","../src/utils/wallets/wallets/zerion.ts","../src/utils/wallets/wallets.ts","../src/utils/wallets/wallets/defaultWallet.ts","../src/utils/wallets/getBrowserWalletLabelAndIcon.ts","../src/web3/connectors/index.ts","../node_modules/@wagmi/connectors/dist/chunk-OQILYQDO.js","../node_modules/@wagmi/connectors/dist/chunk-W65LBPLT.js","../node_modules/@wagmi/connectors/dist/mock/index.js","../node_modules/@wagmi/connectors/dist/chunk-UGBGYVBH.js","../node_modules/@wagmi/connectors/dist/chunk-2UFLHRLT.js","../node_modules/@wagmi/core/dist/chunk-MQXBDTVK.js","../node_modules/@wagmi/core/dist/chunk-TSH6VVF4.js","../src/web3/connectors/ImpersonatedConnector.ts","../src/web3/providers/WagmiProvider.tsx","../src/web3/store/transactionsSlice.ts","../src/web3/adapters/EthereumAdapter.ts","../src/web3/adapters/GnosisAdapter.ts","../src/web3/store/walletSlice.ts"],"sourcesContent":["'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","export * from './hooks/useLastTxLocalStatus';\nexport * from './types/store';\nexport * from './utils/chainInfoHelpers';\nexport * from './utils/constants';\nexport * from './utils/localStorage';\nexport * from './utils/wallets/getBrowserWalletLabelAndIcon';\nexport * from './web3/connectors/index';\nexport * from './web3/providers/WagmiProvider';\nexport * from './web3/store/transactionsSelectors';\nexport * from './web3/store/transactionsSlice';\nexport * from './web3/store/walletSlice';\n","import { useEffect, useState } from 'react';\n\nimport { isGelatoBaseTx } from '../web3/adapters/GelatoAdapter';\nimport { selectLastTxByTypeAndPayload } from '../web3/store/transactionsSelectors';\nimport { BaseTx, ITransactionsState } from '../web3/store/transactionsSlice';\n\ninterface LastTxStatusesParams {\n state: ITransactionsState;\n activeAddress: string;\n type: T['type'];\n payload: T['payload'];\n}\n\ntype ExecuteTxWithLocalStatusesParams = {\n errorMessage: string;\n callbackFunction: () => Promise;\n};\n\nexport const useLastTxLocalStatus = ({\n state,\n activeAddress,\n type,\n payload,\n}: LastTxStatusesParams) => {\n const tx = selectLastTxByTypeAndPayload(state, activeAddress, type, payload);\n\n const [fullTxErrorMessage, setFullTxErrorMessage] = useState(\n '',\n );\n const [error, setError] = useState('');\n const [loading, setLoading] = useState(false);\n const [isTxStart, setIsTxStart] = useState(false);\n\n const txHash = tx && tx.hash;\n const txPending = tx && tx.pending;\n const isError =\n tx && isGelatoBaseTx(tx)\n ? !tx.pending && (tx.status !== 1 || !!error)\n : (tx && !tx.pending && tx.status !== 1) || !!error;\n const txSuccess = tx && tx.status === 1 && !isError;\n const txChainId = tx && tx.chainId;\n const txWalletType = tx && tx.walletType;\n\n useEffect(() => {\n return () => {\n setFullTxErrorMessage('');\n setError('');\n };\n }, []);\n\n useEffect(() => {\n if (txPending || isError) {\n setIsTxStart(true);\n }\n }, [txPending, isError]);\n\n useEffect(() => {\n if (tx?.errorMessage) {\n setError(tx.errorMessage);\n }\n }, [tx?.errorMessage]);\n\n async function executeTxWithLocalStatuses({\n errorMessage,\n callbackFunction,\n }: ExecuteTxWithLocalStatusesParams) {\n setError('');\n setLoading(true);\n try {\n await callbackFunction();\n } catch (e) {\n if (e instanceof Error) {\n console.error('TX error: ', e);\n setFullTxErrorMessage(!!e?.message ? e.message : e);\n setError(errorMessage);\n }\n }\n setLoading(false);\n }\n\n return {\n error,\n setError,\n loading,\n setLoading,\n isTxStart,\n setIsTxStart,\n txHash,\n txPending,\n txSuccess,\n txChainId,\n txWalletType,\n isError,\n executeTxWithLocalStatuses,\n fullTxErrorMessage,\n setFullTxErrorMessage,\n };\n};\n","import { produce } from 'immer';\nimport { Hex } from 'viem';\n\nimport { setLocalStorageTxPool } from '../../utils/localStorage';\nimport { selectIsGelatoTXPending } from '../store/transactionsSelectors';\nimport {\n BaseTx,\n GelatoBaseTx,\n InitialTx,\n ITransactionsSlice,\n NewTx,\n} from '../store/transactionsSlice';\nimport { Wallet } from '../store/walletSlice';\nimport { AdapterInterface } from './interface';\n\nexport type GelatoTXState =\n | 'WaitingForConfirmation'\n | 'CheckPending'\n | 'ExecSuccess'\n | 'Cancelled'\n | 'ExecPending'\n | 'ExecReverted';\n\nexport type GelatoTaskStatusResponse = {\n task: {\n chainId: number;\n taskId: string;\n taskState: GelatoTXState;\n creationDate?: string;\n executionDate?: string;\n transactionHash?: Hex;\n blockNumber?: number;\n lastCheckMessage?: string;\n };\n};\n\nexport type GelatoTx = {\n taskId: string;\n};\n\nexport function isGelatoTx(tx: InitialTx): tx is GelatoTx {\n return (tx as GelatoTx).taskId !== undefined;\n}\n\nexport function isGelatoBaseTx(tx: BaseTx): tx is GelatoBaseTx {\n return (tx as GelatoBaseTx).taskId !== undefined;\n}\n\nexport function isGelatoBaseTxWithoutTimestamp(\n tx: Omit,\n): tx is Omit {\n return (tx as GelatoBaseTx).taskId !== undefined;\n}\n\nexport class GelatoAdapter implements AdapterInterface {\n get: () => ITransactionsSlice;\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void;\n transactionsIntervalsMap: Record = {};\n\n constructor(\n get: () => ITransactionsSlice,\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void,\n ) {\n this.get = get;\n this.set = set;\n }\n\n executeTx = async (params: {\n tx: NewTx;\n activeWallet: Wallet;\n payload: object | undefined;\n chainId: number;\n type: T['type'];\n }): Promise => {\n const { activeWallet, chainId, type } = params;\n const tx = params.tx as GelatoTx;\n const from = activeWallet.address;\n const gelatoTX = {\n from: from as Hex,\n chainId,\n type: type,\n taskId: tx.taskId,\n payload: params.payload,\n };\n\n const txPool = this.get().addTXToPool(gelatoTX, activeWallet.walletType);\n this.startTxTracking(tx.taskId);\n\n return txPool[tx.taskId];\n };\n\n startTxTracking = async (taskId: string) => {\n const tx = this.get().transactionsPool[taskId] as GelatoBaseTx;\n\n const isPending = selectIsGelatoTXPending(tx.gelatoStatus);\n if (!isPending) {\n return;\n }\n\n this.stopPollingGelatoTXStatus(taskId);\n\n const newGelatoInterval = setInterval(() => {\n this.fetchGelatoTXStatus(taskId);\n // TODO: maybe change timeout for gelato\n }, 2000);\n\n this.transactionsIntervalsMap[taskId] = Number(newGelatoInterval);\n };\n\n private stopPollingGelatoTXStatus = (taskId: string) => {\n const currentInterval = this.transactionsIntervalsMap[taskId];\n clearInterval(currentInterval);\n this.transactionsIntervalsMap[taskId] = undefined;\n };\n\n private fetchGelatoTXStatus = async (taskId: string) => {\n const response = await fetch(\n `https://api.gelato.digital/tasks/status/${taskId}/`,\n );\n if (!response.ok) {\n // TODO: handle error if needed, for now just skipping\n } else {\n const gelatoStatus = (await response.json()) as GelatoTaskStatusResponse;\n\n const isPending = selectIsGelatoTXPending(gelatoStatus.task.taskState);\n this.updateGelatoTX(taskId, gelatoStatus);\n if (!isPending) {\n this.stopPollingGelatoTXStatus(taskId);\n const tx = this.get().transactionsPool[taskId];\n this.get().txStatusChangedCallback(tx);\n }\n }\n };\n\n private updateGelatoTX = (\n taskId: string,\n statusResponse: GelatoTaskStatusResponse,\n ) => {\n this.set((state) =>\n produce(state, (draft) => {\n const tx = draft.transactionsPool[taskId] as GelatoBaseTx & {\n pending: boolean;\n status?: number;\n };\n tx.gelatoStatus = statusResponse.task.taskState;\n tx.pending = selectIsGelatoTXPending(statusResponse.task.taskState);\n tx.hash = statusResponse.task.transactionHash;\n tx.status =\n statusResponse.task.taskState === 'ExecSuccess'\n ? 1\n : tx.pending\n ? undefined\n : 0;\n if (statusResponse.task.executionDate) {\n tx.timestamp = new Date(statusResponse.task.executionDate).getTime();\n }\n if (statusResponse.task.lastCheckMessage) {\n tx.errorMessage = statusResponse.task.lastCheckMessage;\n }\n }),\n );\n setLocalStorageTxPool(this.get().transactionsPool);\n };\n}\n","import { WalletType } from '../web3/connectors';\nimport { BaseTx, TransactionPool } from '../web3/store/transactionsSlice';\n\nexport enum LocalStorageKeys {\n LastConnectedWallet = 'LastConnectedWallet',\n TransactionPool = 'TransactionPool',\n}\n\nexport const setLocalStorageTxPool = (\n pool: TransactionPool,\n) => {\n const stringifiedPool = JSON.stringify(pool);\n localStorage.setItem(LocalStorageKeys.TransactionPool, stringifiedPool);\n};\n\nexport const getLocalStorageTxPool = () => {\n return localStorage.getItem(LocalStorageKeys.TransactionPool);\n};\n\nexport const setLocalStorageWallet = (walletType: WalletType) => {\n localStorage.setItem(LocalStorageKeys.LastConnectedWallet, walletType);\n};\n\nexport const deleteLocalStorageWallet = () => {\n localStorage.removeItem(LocalStorageKeys.LastConnectedWallet);\n localStorage.removeItem('wagmi.wallet');\n};\n\nexport const clearWalletLinkLocalStorage = () => {\n localStorage.removeItem('walletconnect');\n localStorage.removeItem('-walletlink:https://www.walletlink.org:version');\n localStorage.removeItem('-walletlink:https://www.walletlink.org:session:id');\n localStorage.removeItem(\n '-walletlink:https://www.walletlink.org:session:secret',\n );\n localStorage.removeItem(\n '-walletlink:https://www.walletlink.org:session:linked',\n );\n localStorage.removeItem('-walletlink:https://www.walletlink.org:AppVersion');\n localStorage.removeItem('-walletlink:https://www.walletlink.org:Addresses');\n localStorage.removeItem(\n '-walletlink:https://www.walletlink.org:walletUsername',\n );\n};\n\nexport const clearWalletConnectV2LocalStorage = () => {\n localStorage.removeItem('wc@2:core:0.3//messages');\n localStorage.removeItem('wc@2:client:0.3//proposal');\n localStorage.removeItem('wc@2:universal_provider:/namespaces');\n localStorage.removeItem('wc@2:core:0.3//subscription');\n localStorage.removeItem('wc@2:core:0.3//history');\n localStorage.removeItem('wc@2:core:0.3//expirer');\n localStorage.removeItem('wc@2:core:0.3//pairing');\n localStorage.removeItem('wc@2:universal_provider:/optionalNamespaces');\n};\n","import isEqual from 'lodash/isEqual.js';\nimport { Chain } from 'viem';\nimport { goerli, mainnet } from 'viem/chains';\n\nimport { isGelatoBaseTx } from '../adapters/GelatoAdapter';\nimport { BaseTx, GelatoBaseTx, ITransactionsState } from './transactionsSlice';\n\nexport const selectAllTransactions = (\n state: ITransactionsState,\n) => {\n return Object.values(state.transactionsPool).sort(\n (a, b) => Number(a.localTimestamp) - Number(b.localTimestamp),\n );\n};\n\nexport const selectPendingTransactions = (\n state: ITransactionsState,\n) => {\n return selectAllTransactions(state).filter((tx) => tx.pending);\n};\n\nexport const selectTXByKey = (\n state: ITransactionsState,\n key: string,\n) => {\n return state.transactionsPool[key];\n};\n\nexport const selectTXByHash = (\n state: ITransactionsState,\n hash: string,\n) => {\n const txByKey = selectTXByKey(state, hash);\n if (txByKey) {\n return txByKey;\n }\n return selectAllTransactions(state).find((tx) => tx.hash === hash);\n};\n\nexport const selectAllTransactionsByWallet = (\n state: ITransactionsState,\n from: string,\n) => {\n return selectAllTransactions(state).filter((tx) => tx.from === from);\n};\n\nexport const selectPendingTransactionByWallet = (\n state: ITransactionsState,\n from: string,\n) => {\n return selectPendingTransactions(state).filter((tx) => tx.from === from);\n};\n\nexport const selectLastTxByTypeAndPayload = (\n state: ITransactionsState,\n from: string,\n type: T['type'],\n payload: T['payload'],\n) => {\n const allTransactions = selectAllTransactionsByWallet(state, from);\n const filteredTransactions = allTransactions.filter(\n (tx) => tx.type === type && isEqual(tx.payload, payload),\n );\n const lastFilteredTransaction =\n filteredTransactions[filteredTransactions.length - 1];\n\n if (lastFilteredTransaction) {\n if (isGelatoBaseTx(lastFilteredTransaction)) {\n return selectTXByKey(state, lastFilteredTransaction.taskId);\n } else {\n if (lastFilteredTransaction.hash) {\n return selectTXByKey(state, lastFilteredTransaction.hash);\n } else {\n return undefined;\n }\n }\n } else {\n return undefined;\n }\n};\n\nexport const selectTxExplorerLink = (\n state: ITransactionsState,\n getChainParameters: (chainId: number) => Chain,\n txHash: string,\n) => {\n const tx = selectTXByHash(state, txHash);\n if (!tx) {\n return '';\n }\n\n // TODO: need check\n const gnosisSafeLinksHelper: Record = {\n [mainnet.id]: 'https://app.safe.global/eth:',\n [goerli.id]: 'https://app.safe.global/gor:',\n };\n\n if (tx.walletType !== 'GnosisSafe') {\n return `${getChainParameters(tx.chainId).blockExplorers}/tx/${txHash}`;\n } else {\n return `${gnosisSafeLinksHelper[tx.chainId]}${\n tx.from\n }/transactions/tx?id=multisig_${tx.from}_${txHash}`;\n }\n};\n\nexport const selectIsGelatoTXPending = (\n gelatoStatus?: GelatoBaseTx['gelatoStatus'],\n) => {\n return (\n gelatoStatus === undefined ||\n gelatoStatus === 'CheckPending' ||\n gelatoStatus === 'WaitingForConfirmation' ||\n gelatoStatus === 'ExecPending'\n );\n};\n","import { Chain, createPublicClient, http, PublicClient } from 'viem';\nimport {\n avalanche,\n avalancheFuji,\n goerli,\n mainnet,\n polygon,\n polygonMumbai,\n sepolia,\n} from 'viem/chains';\n\nexport const initialChains: Record = {\n [mainnet.id]: mainnet,\n [polygon.id]: polygon,\n [polygonMumbai.id]: polygonMumbai,\n [avalanche.id]: avalanche,\n [avalancheFuji.id]: avalancheFuji,\n [goerli.id]: goerli,\n [sepolia.id]: sepolia,\n};\n\nexport const initChainInformationConfig = (chains?: Record) => {\n const CHAINS = { ...initialChains, ...chains } || {};\n\n // init clients instances from chain config\n const initalizedClients: Record = {};\n const clientInstances = Object.values(CHAINS).reduce<{\n [chainId: number]: {\n instance: PublicClient;\n };\n }>((accumulator, chain) => {\n const numberChainId = Number(chain.id);\n accumulator[numberChainId] = {\n get instance() {\n if (initalizedClients[numberChainId]) {\n return initalizedClients[numberChainId];\n } else {\n const client = createPublicClient({\n batch: {\n multicall: true,\n },\n chain,\n transport: http(),\n }) as PublicClient;\n initalizedClients[numberChainId] = client;\n return client;\n }\n },\n } as {\n instance: PublicClient;\n };\n return accumulator;\n }, {});\n\n function getChainParameters(chainId: number): Chain {\n const chainInformation = CHAINS[chainId];\n if (chainInformation) {\n return chainInformation;\n } else {\n // this case can only ever occure when a wallet is connected with an unknown chainId which will not allow interaction\n return {\n ...mainnet,\n id: chainId,\n name: `unknown network: ${chainId}`,\n };\n }\n }\n\n return {\n clientInstances,\n getChainParameters,\n };\n};\n","import {\n arbitrum,\n avalanche,\n goerli,\n mainnet,\n optimism,\n polygon,\n} from 'viem/chains';\n\nexport const SafeTransactionServiceUrls: { [key in number]: string } = {\n [mainnet.id]: 'https://safe-transaction-mainnet.safe.global/api/v1',\n [goerli.id]: 'https://safe-transaction-goerli.safe.global/api/v1',\n [optimism.id]: 'https://safe-transaction-optimism.safe.global/api/v1',\n [polygon.id]: 'https://safe-transaction-polygon.safe.global/api/v1',\n [arbitrum.id]: 'https://safe-transaction-arbitrum.safe.global/api/v1',\n [avalanche.id]: 'https://safe-transaction-avalanche.safe.global/api/v1',\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const alphawallet = {\n identityFlag: WalletIdentityFlag.AlphaWallet,\n label: WalletLabel.AlphaWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const atoken = {\n identityFlag: WalletIdentityFlag.AToken,\n label: WalletLabel.AToken,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const binance = {\n identityFlag: WalletIdentityFlag.Binance,\n label: WalletLabel.Binance,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const bitkeep = {\n identityFlag: WalletIdentityFlag.BitKeep,\n label: WalletLabel.BitKeep,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const bitpie = {\n identityFlag: WalletIdentityFlag.Bitpie,\n label: WalletLabel.Bitpie,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const bitski = {\n identityFlag: WalletIdentityFlag.Bitski,\n label: WalletLabel.Bitski,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const blockwallet = {\n identityFlag: WalletIdentityFlag.BlockWallet,\n label: WalletLabel.BlockWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const brave = {\n identityFlag: WalletIdentityFlag.BraveWallet,\n label: WalletLabel.Brave,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const coinbase = {\n identityFlag: WalletIdentityFlag.Coinbase,\n label: WalletLabel.Coinbase,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const core = {\n identityFlag: WalletIdentityFlag.Core,\n label: WalletLabel.Core,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const dcent = {\n identityFlag: WalletIdentityFlag.Dcent,\n label: WalletLabel.Dcent,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const defiwallet = {\n identityFlag: WalletIdentityFlag.DeFiWallet,\n label: WalletLabel.DeFiWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const enkrypt = {\n identityFlag: WalletIdentityFlag.Enkrypt,\n label: WalletLabel.Enkrypt,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const exodus = {\n identityFlag: WalletIdentityFlag.Exodus,\n label: WalletLabel.Exodus,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const frame = {\n identityFlag: WalletIdentityFlag.Frame,\n label: WalletLabel.Frame,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const frontier = {\n identityFlag: WalletIdentityFlag.Frontier,\n label: WalletLabel.Frontier,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const gamestop = {\n identityFlag: WalletIdentityFlag.GameStop,\n label: WalletLabel.GameStop,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const huobiwallet = {\n identityFlag: WalletIdentityFlag.HuobiWallet,\n label: WalletLabel.HuobiWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const hyperpay = {\n identityFlag: WalletIdentityFlag.HyperPay,\n label: WalletLabel.HyperPay,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const imtoken = {\n identityFlag: WalletIdentityFlag.ImToken,\n label: WalletLabel.ImToken,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const liquality = {\n identityFlag: WalletIdentityFlag.Liquality,\n label: WalletLabel.Liquality,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const mathwallet = {\n identityFlag: WalletIdentityFlag.MathWallet,\n label: WalletLabel.MathWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const meetone = {\n identityFlag: WalletIdentityFlag.MeetOne,\n label: WalletLabel.MeetOne,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const metamask = {\n identityFlag: WalletIdentityFlag.MetaMask,\n label: WalletLabel.MetaMask,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const mykey = {\n identityFlag: WalletIdentityFlag.MyKey,\n label: WalletLabel.MyKey,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const okxwallet = {\n identityFlag: WalletIdentityFlag.OKXWallet,\n label: WalletLabel.OKXWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const oneInch = {\n identityFlag: WalletIdentityFlag.OneInch,\n label: WalletLabel.OneInch,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const opera = {\n identityFlag: WalletIdentityFlag.Opera,\n label: WalletLabel.Opera,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const ownbit = {\n identityFlag: WalletIdentityFlag.OwnBit,\n label: WalletLabel.OwnBit,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const phantom = {\n identityFlag: WalletIdentityFlag.Phantom,\n label: WalletLabel.Phantom,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const rabby = {\n identityFlag: WalletIdentityFlag.Rabby,\n label: WalletLabel.Rabby,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const rainbow = {\n identityFlag: WalletIdentityFlag.Rainbow,\n label: WalletLabel.Rainbow,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const safepal = {\n identityFlag: WalletIdentityFlag.SafePal,\n label: WalletLabel.SafePal,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const sequence = {\n identityFlag: WalletIdentityFlag.Sequence,\n label: WalletLabel.Sequence,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const status = {\n identityFlag: WalletIdentityFlag.Status,\n label: WalletLabel.Status,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tallywallet = {\n identityFlag: WalletIdentityFlag.Tally,\n label: WalletLabel.Tally,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tokenary = {\n identityFlag: WalletIdentityFlag.Tokenary,\n label: WalletLabel.Tokenary,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tokenpocket = {\n identityFlag: WalletIdentityFlag.TokenPocket,\n label: WalletLabel.TokenPocket,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tp = {\n identityFlag: WalletIdentityFlag.TP,\n label: WalletLabel.TP,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const trust = {\n identityFlag: WalletIdentityFlag.Trust,\n label: WalletLabel.Trust,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const walletio = {\n identityFlag: WalletIdentityFlag.WalletIo,\n label: WalletLabel.WalletIo,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const xdefi = {\n identityFlag: WalletIdentityFlag.XDEFI,\n label: WalletLabel.XDEFI,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const zeal = {\n identityFlag: WalletIdentityFlag.Zeal,\n label: WalletLabel.Zeal,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const zerion = {\n identityFlag: WalletIdentityFlag.Zerion,\n label: WalletLabel.Zerion,\n icon: ``,\n};\n","import { alphawallet } from './wallets/alphawallet';\nimport { atoken } from './wallets/atoken';\nimport { binance } from './wallets/binance';\nimport { bitkeep } from './wallets/bitkeep';\nimport { bitpie } from './wallets/bitpie';\nimport { bitski } from './wallets/bitski';\nimport { blockwallet } from './wallets/blockwallet';\nimport { brave } from './wallets/brave';\nimport { coinbase } from './wallets/coinbase';\nimport { core } from './wallets/core';\nimport { dcent } from './wallets/dcent';\nimport { defiwallet } from './wallets/defiwallet';\nimport { enkrypt } from './wallets/enkrypt';\nimport { exodus } from './wallets/exodus';\nimport { frame } from './wallets/frame';\nimport { frontier } from './wallets/frontier';\nimport { gamestop } from './wallets/gamestop';\nimport { huobiwallet } from './wallets/huobiwallet';\nimport { hyperpay } from './wallets/hyperpay';\nimport { imtoken } from './wallets/imtoken';\nimport { liquality } from './wallets/liquality';\nimport { mathwallet } from './wallets/mathwallet';\nimport { meetone } from './wallets/meetone';\nimport { metamask } from './wallets/metamask';\nimport { mykey } from './wallets/mykey';\nimport { okxwallet } from './wallets/okxwallet';\nimport { oneInch } from './wallets/oneInch';\nimport { opera } from './wallets/opera';\nimport { ownbit } from './wallets/ownbit';\nimport { phantom } from './wallets/phantom';\nimport { rabby } from './wallets/rabby';\nimport { rainbow } from './wallets/rainbow';\nimport { safepal } from './wallets/safepal';\nimport { sequence } from './wallets/sequence';\nimport { status } from './wallets/status';\nimport { tallywallet } from './wallets/tallywallet';\nimport { tokenary } from './wallets/tokenary';\nimport { tokenpocket } from './wallets/tokenpocket';\nimport { tp } from './wallets/tp';\nimport { trust } from './wallets/trust';\nimport { walletio } from './wallets/walletio';\nimport { xdefi } from './wallets/xdefi';\nimport { zeal } from './wallets/zeal';\nimport { zerion } from './wallets/zerion';\n\nexport const wallets = [\n alphawallet,\n atoken,\n binance,\n bitkeep,\n bitpie,\n bitski,\n blockwallet,\n brave,\n coinbase,\n core,\n dcent,\n defiwallet,\n enkrypt,\n exodus,\n frame,\n frontier,\n gamestop,\n huobiwallet,\n hyperpay,\n imtoken,\n liquality,\n mathwallet,\n meetone,\n metamask,\n mykey,\n okxwallet,\n oneInch,\n opera,\n ownbit,\n phantom,\n rabby,\n rainbow,\n safepal,\n sequence,\n status,\n tallywallet,\n tokenary,\n tokenpocket,\n tp,\n trust,\n walletio,\n xdefi,\n zeal,\n zerion,\n];\n","export const defaultWallet = {\n label: 'Browser wallet',\n icon: ``,\n};\n","import { wallets } from './wallets';\nimport { defaultWallet } from './wallets/defaultWallet';\n\nexport function getBrowserWalletLabelAndIcon() {\n const defaultBrowserWallet = {\n label: defaultWallet.label,\n icon: defaultWallet.icon,\n };\n\n if (typeof window !== 'undefined') {\n if (!!window.ethereum) {\n const userBrowserWallets = wallets.filter(\n (wallet) => !!window.ethereum[wallet.identityFlag],\n );\n if (userBrowserWallets.length > 1 || userBrowserWallets.length === 0) {\n return defaultBrowserWallet;\n } else {\n return {\n label: userBrowserWallets[0].label,\n icon: userBrowserWallets[0].icon,\n };\n }\n } else {\n return defaultBrowserWallet;\n }\n } else {\n return defaultBrowserWallet;\n }\n}\n","import { Chain } from 'viem';\nimport { CoinbaseWalletConnector } from 'wagmi/connectors/coinbaseWallet';\nimport { InjectedConnector } from 'wagmi/connectors/injected';\nimport { SafeConnector } from 'wagmi/connectors/safe';\nimport { WalletConnectConnector } from 'wagmi/connectors/walletConnect';\n\nimport { ImpersonatedConnector } from './ImpersonatedConnector';\n\nexport type ConnectorType =\n | InjectedConnector\n | WalletConnectConnector\n | CoinbaseWalletConnector\n | SafeConnector\n | ImpersonatedConnector;\n\nexport type AllConnectorsInitProps = {\n appName: string;\n chains: Record;\n defaultChainId?: number;\n wcParams?: {\n projectId: string;\n metadata: {\n name: string;\n description: string;\n url: string;\n icons: string[];\n };\n };\n};\n\nexport const initAllConnectors = (props: AllConnectorsInitProps) => {\n const chains = Object.values(props.chains);\n const chainIds = Object.keys(props.chains).map(Number);\n\n const wcParams = props.wcParams;\n let walletConnect: WalletConnectConnector | null = null;\n if (wcParams) {\n walletConnect = new WalletConnectConnector({\n chains,\n options: {\n ...wcParams,\n },\n });\n }\n\n const injected = new InjectedConnector({\n chains,\n options: {\n name: (detectedName) =>\n `${\n typeof detectedName === 'string'\n ? detectedName\n : detectedName.join(', ')\n }`,\n },\n });\n const coinbase = new CoinbaseWalletConnector({\n chains,\n options: {\n appName: props.appName,\n jsonRpcUrl:\n props.chains[props.defaultChainId || chainIds[0]].rpcUrls.default\n .http[0],\n },\n });\n const gnosisSafe = new SafeConnector({\n chains,\n options: {\n allowedDomains: [/gnosis-safe.io$/, /app.safe.global$/],\n debug: false,\n },\n });\n\n const impersonated = new ImpersonatedConnector({\n chains,\n options: {\n chainId: props.chains[props.defaultChainId || chainIds[0]].id,\n },\n });\n\n const connectors: ConnectorType[] = [\n injected,\n coinbase,\n gnosisSafe,\n impersonated,\n ];\n if (walletConnect !== null) {\n connectors.push(walletConnect);\n }\n\n return connectors;\n};\n\nexport type WalletType =\n | 'Injected'\n | 'WalletConnect'\n | 'Coinbase'\n | 'GnosisSafe'\n | 'Impersonated';\n\nexport function getConnectorName(\n connector: ConnectorType,\n): WalletType | undefined {\n if (connector instanceof InjectedConnector) return 'Injected';\n if (connector instanceof WalletConnectConnector) return 'WalletConnect';\n if (connector instanceof CoinbaseWalletConnector) return 'Coinbase';\n if (connector instanceof SafeConnector) return 'GnosisSafe';\n if (connector instanceof ImpersonatedConnector) return 'Impersonated';\n return;\n}\n","// src/utils/normalizeChainId.ts\nfunction normalizeChainId(chainId) {\n if (typeof chainId === \"string\")\n return Number.parseInt(\n chainId,\n chainId.trim().substring(0, 2) === \"0x\" ? 16 : 10\n );\n if (typeof chainId === \"bigint\")\n return Number(chainId);\n return chainId;\n}\n\nexport {\n normalizeChainId\n};\n","var __accessCheck = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n};\nvar __privateGet = (obj, member, getter) => {\n __accessCheck(obj, member, \"read from private field\");\n return getter ? getter.call(obj) : member.get(obj);\n};\nvar __privateAdd = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n};\nvar __privateSet = (obj, member, value, setter) => {\n __accessCheck(obj, member, \"write to private field\");\n setter ? setter.call(obj, value) : member.set(obj, value);\n return value;\n};\nvar __privateMethod = (obj, member, method) => {\n __accessCheck(obj, member, \"access private method\");\n return method;\n};\n\n// src/base.ts\nimport { default as EventEmitter } from \"eventemitter3\";\nimport { goerli, mainnet } from \"viem/chains\";\nvar Connector = class extends EventEmitter {\n constructor({\n chains = [mainnet, goerli],\n options\n }) {\n super();\n this.chains = chains;\n this.options = options;\n }\n getBlockExplorerUrls(chain) {\n const { default: blockExplorer, ...blockExplorers } = chain.blockExplorers ?? {};\n if (blockExplorer)\n return [\n blockExplorer.url,\n ...Object.values(blockExplorers).map((x) => x.url)\n ];\n }\n isChainUnsupported(chainId) {\n return !this.chains.some((x) => x.id === chainId);\n }\n setStorage(storage) {\n this.storage = storage;\n }\n};\n\nexport {\n __privateGet,\n __privateAdd,\n __privateSet,\n __privateMethod,\n Connector\n};\n","import {\n normalizeChainId\n} from \"../chunk-OQILYQDO.js\";\nimport {\n Connector,\n __privateAdd,\n __privateGet,\n __privateMethod,\n __privateSet\n} from \"../chunk-W65LBPLT.js\";\n\n// src/mock/connector.ts\nimport { getAddress as getAddress2 } from \"viem\";\n\n// src/mock/provider.ts\nimport { default as EventEmitter } from \"eventemitter3\";\nimport { UserRejectedRequestError, getAddress } from \"viem\";\nvar _options, _walletClient;\nvar MockProvider = class {\n constructor(options) {\n this.events = new EventEmitter();\n __privateAdd(this, _options, void 0);\n __privateAdd(this, _walletClient, void 0);\n this.chainId = options.chainId;\n __privateSet(this, _options, options);\n }\n async enable() {\n if (__privateGet(this, _options).flags?.failConnect)\n throw new UserRejectedRequestError(new Error(\"Failed to connect.\"));\n if (!__privateGet(this, _walletClient))\n __privateSet(this, _walletClient, __privateGet(this, _options).walletClient);\n const address = __privateGet(this, _walletClient).account.address;\n this.events.emit(\"accountsChanged\", [address]);\n return [address];\n }\n async disconnect() {\n this.events.emit(\"disconnect\");\n __privateSet(this, _walletClient, void 0);\n }\n async getAccounts() {\n const address = __privateGet(this, _walletClient)?.account.address;\n if (!address)\n return [];\n return [getAddress(address)];\n }\n getWalletClient() {\n const walletClient = __privateGet(this, _walletClient);\n if (!walletClient)\n throw new Error(\"walletClient not found\");\n return walletClient;\n }\n async switchChain(chainId) {\n if (__privateGet(this, _options).flags?.failSwitchChain)\n throw new UserRejectedRequestError(new Error(\"Failed to switch chain.\"));\n __privateGet(this, _options).chainId = chainId;\n this.chainId = chainId;\n this.events.emit(\"chainChanged\", chainId);\n }\n async switchWalletClient(walletClient) {\n const address = walletClient.account.address;\n __privateSet(this, _walletClient, walletClient);\n this.events.emit(\"accountsChanged\", [address]);\n }\n async watchAsset(_asset) {\n return true;\n }\n async request({ method, params }) {\n return __privateGet(this, _walletClient)?.transport.request({ method, params });\n }\n on(event, listener) {\n this.events.on(event, listener);\n return this;\n }\n removeListener(event, listener) {\n this.events.removeListener(event, listener);\n return this;\n }\n toJSON() {\n return \"\";\n }\n};\n_options = new WeakMap();\n_walletClient = new WeakMap();\n\n// src/mock/connector.ts\nvar _provider, _switchChain, switchChain_fn;\nvar MockConnector = class extends Connector {\n constructor({\n chains,\n options\n }) {\n super({\n chains,\n options: {\n ...options,\n chainId: options.chainId ?? chains?.[0]?.id\n }\n });\n __privateAdd(this, _switchChain);\n this.id = \"mock\";\n this.name = \"Mock\";\n this.ready = true;\n __privateAdd(this, _provider, void 0);\n this.onAccountsChanged = (accounts) => {\n if (accounts.length === 0)\n this.emit(\"disconnect\");\n else\n this.emit(\"change\", { account: getAddress2(accounts[0]) });\n };\n this.onChainChanged = (chainId) => {\n const id = normalizeChainId(chainId);\n const unsupported = this.isChainUnsupported(id);\n this.emit(\"change\", { chain: { id, unsupported } });\n };\n this.onDisconnect = () => {\n this.emit(\"disconnect\");\n };\n }\n async connect({ chainId } = {}) {\n const provider = await this.getProvider({ chainId });\n provider.on(\"accountsChanged\", this.onAccountsChanged);\n provider.on(\"chainChanged\", this.onChainChanged);\n provider.on(\"disconnect\", this.onDisconnect);\n this.emit(\"message\", { type: \"connecting\" });\n const accounts = await provider.enable();\n const account = getAddress2(accounts[0]);\n const id = normalizeChainId(provider.chainId);\n const unsupported = this.isChainUnsupported(id);\n const data = { account, chain: { id, unsupported }, provider };\n if (!this.options.flags?.noSwitchChain)\n this.switchChain = __privateMethod(this, _switchChain, switchChain_fn);\n return new Promise(\n (res) => setTimeout(() => res(data), 100)\n );\n }\n async disconnect() {\n const provider = await this.getProvider();\n await provider.disconnect();\n provider.removeListener(\"accountsChanged\", this.onAccountsChanged);\n provider.removeListener(\"chainChanged\", this.onChainChanged);\n provider.removeListener(\"disconnect\", this.onDisconnect);\n }\n async getAccount() {\n const provider = await this.getProvider();\n const accounts = await provider.getAccounts();\n const account = accounts[0];\n if (!account)\n throw new Error(\"Failed to get account\");\n return getAddress2(account);\n }\n async getChainId() {\n const provider = await this.getProvider();\n return normalizeChainId(provider.chainId);\n }\n async getProvider({ chainId } = {}) {\n if (!__privateGet(this, _provider) || chainId)\n __privateSet(this, _provider, new MockProvider({\n ...this.options,\n chainId: chainId ?? this.options.chainId ?? this.chains[0].id\n }));\n return __privateGet(this, _provider);\n }\n async getWalletClient() {\n const provider = await this.getProvider();\n return provider.getWalletClient();\n }\n async isAuthorized() {\n try {\n const provider = await this.getProvider();\n const account = await provider.getAccounts();\n return this.options.flags?.isAuthorized ?? !!account;\n } catch {\n return false;\n }\n }\n async watchAsset(asset) {\n const provider = await this.getProvider();\n return provider.watchAsset(asset);\n }\n toJSON() {\n return \"\";\n }\n};\n_provider = new WeakMap();\n_switchChain = new WeakSet();\nswitchChain_fn = async function(chainId) {\n const provider = await this.getProvider();\n await provider.switchChain(chainId);\n return this.chains.find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${chainId}`,\n network: `${chainId}`,\n nativeCurrency: { name: \"Ether\", decimals: 18, symbol: \"ETH\" },\n rpcUrls: { default: { http: [\"\"] }, public: { http: [\"\"] } }\n };\n};\nexport {\n MockConnector,\n MockProvider\n};\n","// src/errors.ts\nvar ChainNotConfiguredForConnectorError = class extends Error {\n constructor({\n chainId,\n connectorId\n }) {\n super(`Chain \"${chainId}\" not configured for connector \"${connectorId}\".`);\n this.name = \"ChainNotConfiguredForConnectorError\";\n }\n};\nvar ConnectorNotFoundError = class extends Error {\n constructor() {\n super(...arguments);\n this.name = \"ConnectorNotFoundError\";\n this.message = \"Connector not found\";\n }\n};\n\nexport {\n ChainNotConfiguredForConnectorError,\n ConnectorNotFoundError\n};\n","import {\n ChainNotConfiguredForConnectorError,\n ConnectorNotFoundError\n} from \"./chunk-UGBGYVBH.js\";\nimport {\n normalizeChainId\n} from \"./chunk-OQILYQDO.js\";\nimport {\n Connector,\n __privateAdd,\n __privateGet,\n __privateSet\n} from \"./chunk-W65LBPLT.js\";\n\n// src/injected.ts\nimport {\n ResourceUnavailableRpcError,\n SwitchChainError,\n UserRejectedRequestError,\n createWalletClient,\n custom,\n getAddress,\n numberToHex\n} from \"viem\";\n\n// src/utils/getInjectedName.ts\nfunction getInjectedName(ethereum) {\n if (!ethereum)\n return \"Injected\";\n const getName = (provider) => {\n if (provider.isApexWallet)\n return \"Apex Wallet\";\n if (provider.isAvalanche)\n return \"Core Wallet\";\n if (provider.isBackpack)\n return \"Backpack\";\n if (provider.isBifrost)\n return \"Bifrost Wallet\";\n if (provider.isBitKeep)\n return \"BitKeep\";\n if (provider.isBitski)\n return \"Bitski\";\n if (provider.isBlockWallet)\n return \"BlockWallet\";\n if (provider.isBraveWallet)\n return \"Brave Wallet\";\n if (provider.isCoin98)\n return \"Coin98 Wallet\";\n if (provider.isCoinbaseWallet)\n return \"Coinbase Wallet\";\n if (provider.isDawn)\n return \"Dawn Wallet\";\n if (provider.isDefiant)\n return \"Defiant\";\n if (provider.isDesig)\n return \"Desig Wallet\";\n if (provider.isEnkrypt)\n return \"Enkrypt\";\n if (provider.isExodus)\n return \"Exodus\";\n if (provider.isFordefi)\n return \"Fordefi\";\n if (provider.isFrame)\n return \"Frame\";\n if (provider.isFrontier)\n return \"Frontier Wallet\";\n if (provider.isGamestop)\n return \"GameStop Wallet\";\n if (provider.isHaqqWallet)\n return \"HAQQ Wallet\";\n if (provider.isHyperPay)\n return \"HyperPay Wallet\";\n if (provider.isImToken)\n return \"ImToken\";\n if (provider.isHaloWallet)\n return \"Halo Wallet\";\n if (provider.isKuCoinWallet)\n return \"KuCoin Wallet\";\n if (provider.isMathWallet)\n return \"MathWallet\";\n if (provider.isNovaWallet)\n return \"Nova Wallet\";\n if (provider.isOkxWallet || provider.isOKExWallet)\n return \"OKX Wallet\";\n if (provider.isOneInchIOSWallet || provider.isOneInchAndroidWallet)\n return \"1inch Wallet\";\n if (provider.isOpera)\n return \"Opera\";\n if (provider.isPhantom)\n return \"Phantom\";\n if (provider.isPortal)\n return \"Ripio Portal\";\n if (provider.isRabby)\n return \"Rabby Wallet\";\n if (provider.isRainbow)\n return \"Rainbow\";\n if (provider.isStatus)\n return \"Status\";\n if (provider.isSubWallet)\n return \"SubWallet\";\n if (provider.isTalisman)\n return \"Talisman\";\n if (provider.isTally)\n return \"Taho\";\n if (provider.isTokenPocket)\n return \"TokenPocket\";\n if (provider.isTokenary)\n return \"Tokenary\";\n if (provider.isTrust || provider.isTrustWallet)\n return \"Trust Wallet\";\n if (provider.isTTWallet)\n return \"TTWallet\";\n if (provider.isXDEFI)\n return \"XDEFI Wallet\";\n if (provider.isZeal)\n return \"Zeal\";\n if (provider.isZerion)\n return \"Zerion\";\n if (provider.isMetaMask)\n return \"MetaMask\";\n };\n if (ethereum.providers?.length) {\n const nameSet = /* @__PURE__ */ new Set();\n let unknownCount = 1;\n for (const provider of ethereum.providers) {\n let name = getName(provider);\n if (!name) {\n name = `Unknown Wallet #${unknownCount}`;\n unknownCount += 1;\n }\n nameSet.add(name);\n }\n const names = [...nameSet];\n if (names.length)\n return names;\n return names[0] ?? \"Injected\";\n }\n return getName(ethereum) ?? \"Injected\";\n}\n\n// src/injected.ts\nvar _provider;\nvar InjectedConnector = class extends Connector {\n constructor({\n chains,\n options: options_\n } = {}) {\n const options = {\n shimDisconnect: true,\n getProvider() {\n if (typeof window === \"undefined\")\n return;\n const ethereum = window.ethereum;\n if (ethereum?.providers)\n return ethereum.providers[0];\n return ethereum;\n },\n ...options_\n };\n super({ chains, options });\n this.id = \"injected\";\n __privateAdd(this, _provider, void 0);\n this.shimDisconnectKey = `${this.id}.shimDisconnect`;\n this.onAccountsChanged = (accounts) => {\n if (accounts.length === 0)\n this.emit(\"disconnect\");\n else\n this.emit(\"change\", {\n account: getAddress(accounts[0])\n });\n };\n this.onChainChanged = (chainId) => {\n const id = normalizeChainId(chainId);\n const unsupported = this.isChainUnsupported(id);\n this.emit(\"change\", { chain: { id, unsupported } });\n };\n this.onDisconnect = async (error) => {\n if (error.code === 1013) {\n const provider = await this.getProvider();\n if (provider) {\n const isAuthorized = await this.getAccount();\n if (isAuthorized)\n return;\n }\n }\n this.emit(\"disconnect\");\n if (this.options.shimDisconnect)\n this.storage?.removeItem(this.shimDisconnectKey);\n };\n const provider = options.getProvider();\n if (typeof options.name === \"string\")\n this.name = options.name;\n else if (provider) {\n const detectedName = getInjectedName(provider);\n if (options.name)\n this.name = options.name(detectedName);\n else {\n if (typeof detectedName === \"string\")\n this.name = detectedName;\n else\n this.name = detectedName[0];\n }\n } else\n this.name = \"Injected\";\n this.ready = !!provider;\n }\n async connect({ chainId } = {}) {\n try {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n if (provider.on) {\n provider.on(\"accountsChanged\", this.onAccountsChanged);\n provider.on(\"chainChanged\", this.onChainChanged);\n provider.on(\"disconnect\", this.onDisconnect);\n }\n this.emit(\"message\", { type: \"connecting\" });\n const accounts = await provider.request({\n method: \"eth_requestAccounts\"\n });\n const account = getAddress(accounts[0]);\n let id = await this.getChainId();\n let unsupported = this.isChainUnsupported(id);\n if (chainId && id !== chainId) {\n const chain = await this.switchChain(chainId);\n id = chain.id;\n unsupported = this.isChainUnsupported(id);\n }\n if (this.options.shimDisconnect)\n this.storage?.setItem(this.shimDisconnectKey, true);\n return { account, chain: { id, unsupported } };\n } catch (error) {\n if (this.isUserRejectedRequestError(error))\n throw new UserRejectedRequestError(error);\n if (error.code === -32002)\n throw new ResourceUnavailableRpcError(error);\n throw error;\n }\n }\n async disconnect() {\n const provider = await this.getProvider();\n if (!provider?.removeListener)\n return;\n provider.removeListener(\"accountsChanged\", this.onAccountsChanged);\n provider.removeListener(\"chainChanged\", this.onChainChanged);\n provider.removeListener(\"disconnect\", this.onDisconnect);\n if (this.options.shimDisconnect)\n this.storage?.removeItem(this.shimDisconnectKey);\n }\n async getAccount() {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n const accounts = await provider.request({\n method: \"eth_accounts\"\n });\n return getAddress(accounts[0]);\n }\n async getChainId() {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n return provider.request({ method: \"eth_chainId\" }).then(normalizeChainId);\n }\n async getProvider() {\n const provider = this.options.getProvider();\n if (provider)\n __privateSet(this, _provider, provider);\n return __privateGet(this, _provider);\n }\n async getWalletClient({\n chainId\n } = {}) {\n const [provider, account] = await Promise.all([\n this.getProvider(),\n this.getAccount()\n ]);\n const chain = this.chains.find((x) => x.id === chainId);\n if (!provider)\n throw new Error(\"provider is required.\");\n return createWalletClient({\n account,\n chain,\n transport: custom(provider)\n });\n }\n async isAuthorized() {\n try {\n if (this.options.shimDisconnect && !this.storage?.getItem(this.shimDisconnectKey))\n return false;\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n const account = await this.getAccount();\n return !!account;\n } catch {\n return false;\n }\n }\n async switchChain(chainId) {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n const id = numberToHex(chainId);\n try {\n await Promise.all([\n provider.request({\n method: \"wallet_switchEthereumChain\",\n params: [{ chainId: id }]\n }),\n new Promise(\n (res) => this.on(\"change\", ({ chain }) => {\n if (chain?.id === chainId)\n res();\n })\n )\n ]);\n return this.chains.find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${id}`,\n network: `${id}`,\n nativeCurrency: { name: \"Ether\", decimals: 18, symbol: \"ETH\" },\n rpcUrls: { default: { http: [\"\"] }, public: { http: [\"\"] } }\n };\n } catch (error) {\n const chain = this.chains.find((x) => x.id === chainId);\n if (!chain)\n throw new ChainNotConfiguredForConnectorError({\n chainId,\n connectorId: this.id\n });\n if (error.code === 4902 || error?.data?.originalError?.code === 4902) {\n try {\n await provider.request({\n method: \"wallet_addEthereumChain\",\n params: [\n {\n chainId: id,\n chainName: chain.name,\n nativeCurrency: chain.nativeCurrency,\n rpcUrls: [chain.rpcUrls.public?.http[0] ?? \"\"],\n blockExplorerUrls: this.getBlockExplorerUrls(chain)\n }\n ]\n });\n const currentChainId = await this.getChainId();\n if (currentChainId !== chainId)\n throw new UserRejectedRequestError(\n new Error(\"User rejected switch after adding network.\")\n );\n return chain;\n } catch (error2) {\n throw new UserRejectedRequestError(error2);\n }\n }\n if (this.isUserRejectedRequestError(error))\n throw new UserRejectedRequestError(error);\n throw new SwitchChainError(error);\n }\n }\n async watchAsset({\n address,\n decimals = 18,\n image,\n symbol\n }) {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n return provider.request({\n method: \"wallet_watchAsset\",\n params: {\n type: \"ERC20\",\n options: {\n address,\n decimals,\n image,\n symbol\n }\n }\n });\n }\n isUserRejectedRequestError(error) {\n return error.code === 4001;\n }\n};\n_provider = new WeakMap();\n\nexport {\n InjectedConnector\n};\n","var __accessCheck = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n};\nvar __privateGet = (obj, member, getter) => {\n __accessCheck(obj, member, \"read from private field\");\n return getter ? getter.call(obj) : member.get(obj);\n};\nvar __privateAdd = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n};\nvar __privateSet = (obj, member, value, setter) => {\n __accessCheck(obj, member, \"write to private field\");\n setter ? setter.call(obj, value) : member.set(obj, value);\n return value;\n};\nvar __privateMethod = (obj, member, method) => {\n __accessCheck(obj, member, \"access private method\");\n return method;\n};\n\nexport {\n __privateGet,\n __privateAdd,\n __privateSet,\n __privateMethod\n};\n","import {\n InjectedConnector\n} from \"./chunk-BVC4KGLQ.js\";\nimport {\n __privateAdd,\n __privateGet,\n __privateMethod,\n __privateSet\n} from \"./chunk-MQXBDTVK.js\";\n\n// src/utils/configureChains.ts\nimport { createPublicClient, fallback, http, webSocket } from \"viem\";\nfunction configureChains(defaultChains, providers, {\n batch = { multicall: { wait: 32 } },\n pollingInterval = 4e3,\n rank,\n retryCount,\n retryDelay,\n stallTimeout\n} = {}) {\n if (!defaultChains.length)\n throw new Error(\"must have at least one chain\");\n let chains = [];\n const httpUrls = {};\n const wsUrls = {};\n for (const chain of defaultChains) {\n let configExists = false;\n for (const provider of providers) {\n const apiConfig = provider(chain);\n if (!apiConfig)\n continue;\n configExists = true;\n if (!chains.some(({ id }) => id === chain.id)) {\n chains = [...chains, apiConfig.chain];\n }\n httpUrls[chain.id] = [\n ...httpUrls[chain.id] || [],\n ...apiConfig.rpcUrls.http\n ];\n if (apiConfig.rpcUrls.webSocket) {\n wsUrls[chain.id] = [\n ...wsUrls[chain.id] || [],\n ...apiConfig.rpcUrls.webSocket\n ];\n }\n }\n if (!configExists) {\n throw new Error(\n [\n `Could not find valid provider configuration for chain \"${chain.name}\".\n`,\n \"You may need to add `jsonRpcProvider` to `configureChains` with the chain's RPC URLs.\",\n \"Read more: https://wagmi.sh/core/providers/jsonRpc\"\n ].join(\"\\n\")\n );\n }\n }\n return {\n chains,\n publicClient: ({ chainId }) => {\n const activeChain = chains.find((x) => x.id === chainId) ?? defaultChains[0];\n const chainHttpUrls = httpUrls[activeChain.id];\n if (!chainHttpUrls || !chainHttpUrls[0])\n throw new Error(`No providers configured for chain \"${activeChain.id}\"`);\n const publicClient = createPublicClient({\n batch,\n chain: activeChain,\n transport: fallback(\n chainHttpUrls.map((url) => http(url, { timeout: stallTimeout })),\n { rank, retryCount, retryDelay }\n ),\n pollingInterval\n });\n return Object.assign(publicClient, {\n chains\n });\n },\n webSocketPublicClient: ({ chainId }) => {\n const activeChain = chains.find((x) => x.id === chainId) ?? defaultChains[0];\n const chainWsUrls = wsUrls[activeChain.id];\n if (!chainWsUrls || !chainWsUrls[0])\n return void 0;\n const publicClient = createPublicClient({\n batch,\n chain: activeChain,\n transport: fallback(\n chainWsUrls.map((url) => webSocket(url, { timeout: stallTimeout })),\n { rank, retryCount, retryDelay }\n ),\n pollingInterval\n });\n return Object.assign(publicClient, {\n chains\n });\n }\n };\n}\n\n// src/errors.ts\nimport { ConnectorNotFoundError } from \"@wagmi/connectors\";\nvar ChainMismatchError = class extends Error {\n constructor({\n activeChain,\n targetChain\n }) {\n super(\n `Chain mismatch: Expected \"${targetChain}\", received \"${activeChain}\".`\n );\n this.name = \"ChainMismatchError\";\n }\n};\nvar ChainNotConfiguredError = class extends Error {\n constructor({\n chainId,\n connectorId\n }) {\n super(\n `Chain \"${chainId}\" not configured${connectorId ? ` for connector \"${connectorId}\"` : \"\"}.`\n );\n this.name = \"ChainNotConfigured\";\n }\n};\nvar ConnectorAlreadyConnectedError = class extends Error {\n constructor() {\n super(...arguments);\n this.name = \"ConnectorAlreadyConnectedError\";\n this.message = \"Connector already connected\";\n }\n};\nvar ConfigChainsNotFound = class extends Error {\n constructor() {\n super(...arguments);\n this.name = \"ConfigChainsNotFound\";\n this.message = \"No chains were found on the wagmi config. Some functions that require a chain may not work.\";\n }\n};\nvar SwitchChainNotSupportedError = class extends Error {\n constructor({ connector }) {\n super(`\"${connector.name}\" does not support programmatic chain switching.`);\n this.name = \"SwitchChainNotSupportedError\";\n }\n};\n\n// src/utils/deepEqual.ts\nfunction 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 return a !== a && b !== b;\n}\n\n// src/utils/deserialize.ts\nvar findAndReplace = (cacheRef, {\n find,\n replace\n}) => {\n if (cacheRef && find(cacheRef)) {\n return replace(cacheRef);\n }\n if (typeof cacheRef !== \"object\") {\n return cacheRef;\n }\n if (Array.isArray(cacheRef)) {\n return cacheRef.map((item) => findAndReplace(item, { find, replace }));\n }\n if (cacheRef instanceof Object) {\n return Object.entries(cacheRef).reduce(\n (curr, [key, value]) => ({\n ...curr,\n [key]: findAndReplace(value, { find, replace })\n }),\n {}\n );\n }\n return cacheRef;\n};\nfunction deserialize(cachedString) {\n const cache = JSON.parse(cachedString);\n const deserializedCacheWithBigInts = findAndReplace(cache, {\n find: (data) => typeof data === \"string\" && data.startsWith(\"#bigint.\"),\n replace: (data) => BigInt(data.replace(\"#bigint.\", \"\"))\n });\n return deserializedCacheWithBigInts;\n}\n\n// src/utils/getParameters.ts\nfunction getCallParameters(args) {\n return {\n accessList: args.accessList,\n account: args.account,\n blockNumber: args.blockNumber,\n blockTag: args.blockTag,\n data: args.data,\n gas: args.gas,\n gasPrice: args.gasPrice,\n maxFeePerGas: args.maxFeePerGas,\n maxPriorityFeePerGas: args.maxPriorityFeePerGas,\n nonce: args.nonce,\n to: args.to,\n value: args.value\n };\n}\nfunction getSendTransactionParameters(args) {\n return {\n accessList: args.accessList,\n account: args.account,\n data: args.data,\n gas: args.gas,\n gasPrice: args.gasPrice,\n maxFeePerGas: args.maxFeePerGas,\n maxPriorityFeePerGas: args.maxPriorityFeePerGas,\n nonce: args.nonce,\n to: args.to,\n value: args.value\n };\n}\n\n// src/utils/getUnit.ts\nimport { weiUnits } from \"viem\";\nfunction 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\n// src/utils/serialize.ts\nfunction getReferenceKey(keys, cutoff) {\n return keys.slice(0, cutoff).join(\".\") || \".\";\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}\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 } 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 ? circularReplacer.call(\n this,\n key,\n value,\n getReferenceKey(keys, valueCutoff)\n ) : `[ref=${getReferenceKey(keys, valueCutoff)}]`;\n }\n } else {\n cache[0] = value;\n keys[0] = key;\n }\n }\n return hasReplacer ? replacer.call(this, key, value) : value;\n };\n}\nfunction serialize(value, replacer, indent, circularReplacer) {\n return JSON.stringify(\n value,\n createReplacer((key, value_) => {\n const value2 = typeof value_ === \"bigint\" ? `#bigint.${value_.toString()}` : value_;\n return replacer?.(key, value2) || value2;\n }, circularReplacer),\n indent ?? void 0\n );\n}\n\n// src/config.ts\nimport { persist, subscribeWithSelector } from \"zustand/middleware\";\nimport { createStore } from \"zustand/vanilla\";\n\n// src/storage.ts\nvar noopStorage = {\n getItem: (_key) => \"\",\n setItem: (_key, _value) => null,\n removeItem: (_key) => null\n};\nfunction createStorage({\n deserialize: deserialize2 = deserialize,\n key: prefix = \"wagmi\",\n serialize: serialize2 = serialize,\n storage\n}) {\n return {\n ...storage,\n getItem: (key, defaultState = null) => {\n const value = storage.getItem(`${prefix}.${key}`);\n try {\n return value ? deserialize2(value) : defaultState;\n } catch (error) {\n console.warn(error);\n return defaultState;\n }\n },\n setItem: (key, value) => {\n if (value === null) {\n storage.removeItem(`${prefix}.${key}`);\n } else {\n try {\n storage.setItem(`${prefix}.${key}`, serialize2(value));\n } catch (err) {\n console.error(err);\n }\n }\n },\n removeItem: (key) => storage.removeItem(`${prefix}.${key}`)\n };\n}\n\n// src/config.ts\nvar storeKey = \"store\";\nvar _isAutoConnecting, _lastUsedConnector, _addEffects, addEffects_fn;\nvar Config = class {\n constructor({\n autoConnect = false,\n connectors = [new InjectedConnector()],\n publicClient,\n storage = createStorage({\n storage: typeof window !== \"undefined\" ? window.localStorage : noopStorage\n }),\n logger = {\n warn: console.warn\n },\n webSocketPublicClient\n }) {\n __privateAdd(this, _addEffects);\n this.publicClients = /* @__PURE__ */ new Map();\n this.webSocketPublicClients = /* @__PURE__ */ new Map();\n __privateAdd(this, _isAutoConnecting, void 0);\n __privateAdd(this, _lastUsedConnector, void 0);\n this.args = {\n autoConnect,\n connectors,\n logger,\n publicClient,\n storage,\n webSocketPublicClient\n };\n let status = \"disconnected\";\n let chainId;\n if (autoConnect) {\n try {\n const rawState = storage.getItem(storeKey);\n const data = rawState?.state?.data;\n status = data?.account ? \"reconnecting\" : \"connecting\";\n chainId = data?.chain?.id;\n } catch (_error) {\n }\n }\n const connectors_ = typeof connectors === \"function\" ? connectors() : connectors;\n connectors_.forEach((connector) => connector.setStorage(storage));\n this.store = createStore(\n subscribeWithSelector(\n persist(\n () => ({\n connectors: connectors_,\n publicClient: this.getPublicClient({ chainId }),\n status,\n webSocketPublicClient: this.getWebSocketPublicClient({ chainId })\n }),\n {\n name: storeKey,\n storage,\n partialize: (state) => ({\n ...autoConnect && {\n data: {\n account: state?.data?.account,\n chain: state?.data?.chain\n }\n },\n chains: state?.chains\n }),\n version: 2\n }\n )\n )\n );\n this.storage = storage;\n __privateSet(this, _lastUsedConnector, storage?.getItem(\"wallet\"));\n __privateMethod(this, _addEffects, addEffects_fn).call(this);\n if (autoConnect && typeof window !== \"undefined\")\n setTimeout(async () => await this.autoConnect(), 0);\n }\n get chains() {\n return this.store.getState().chains;\n }\n get connectors() {\n return this.store.getState().connectors;\n }\n get connector() {\n return this.store.getState().connector;\n }\n get data() {\n return this.store.getState().data;\n }\n get error() {\n return this.store.getState().error;\n }\n get lastUsedChainId() {\n return this.data?.chain?.id;\n }\n get publicClient() {\n return this.store.getState().publicClient;\n }\n get status() {\n return this.store.getState().status;\n }\n get subscribe() {\n return this.store.subscribe;\n }\n get webSocketPublicClient() {\n return this.store.getState().webSocketPublicClient;\n }\n setState(updater) {\n const newState = typeof updater === \"function\" ? updater(this.store.getState()) : updater;\n this.store.setState(newState, true);\n }\n clearState() {\n this.setState((x) => ({\n ...x,\n chains: void 0,\n connector: void 0,\n data: void 0,\n error: void 0,\n status: \"disconnected\"\n }));\n }\n async destroy() {\n if (this.connector)\n await this.connector.disconnect?.();\n __privateSet(this, _isAutoConnecting, false);\n this.clearState();\n this.store.destroy();\n }\n async autoConnect() {\n if (__privateGet(this, _isAutoConnecting))\n return;\n __privateSet(this, _isAutoConnecting, true);\n this.setState((x) => ({\n ...x,\n status: x.data?.account ? \"reconnecting\" : \"connecting\"\n }));\n const sorted = __privateGet(this, _lastUsedConnector) ? [...this.connectors].sort(\n (x) => x.id === __privateGet(this, _lastUsedConnector) ? -1 : 1\n ) : this.connectors;\n let connected = false;\n for (const connector of sorted) {\n if (!connector.ready || !connector.isAuthorized)\n continue;\n const isAuthorized = await connector.isAuthorized();\n if (!isAuthorized)\n continue;\n const data = await connector.connect();\n this.setState((x) => ({\n ...x,\n connector,\n chains: connector?.chains,\n data,\n status: \"connected\"\n }));\n connected = true;\n break;\n }\n if (!connected)\n this.setState((x) => ({\n ...x,\n data: void 0,\n status: \"disconnected\"\n }));\n __privateSet(this, _isAutoConnecting, false);\n return this.data;\n }\n setConnectors(connectors) {\n this.args = {\n ...this.args,\n connectors\n };\n const connectors_ = typeof connectors === \"function\" ? connectors() : connectors;\n connectors_.forEach((connector) => connector.setStorage(this.args.storage));\n this.setState((x) => ({\n ...x,\n connectors: connectors_\n }));\n }\n getPublicClient({ chainId } = {}) {\n let publicClient_ = this.publicClients.get(-1);\n if (publicClient_ && publicClient_?.chain.id === chainId)\n return publicClient_;\n publicClient_ = this.publicClients.get(chainId ?? -1);\n if (publicClient_)\n return publicClient_;\n const { publicClient } = this.args;\n publicClient_ = typeof publicClient === \"function\" ? publicClient({ chainId }) : publicClient;\n this.publicClients.set(chainId ?? -1, publicClient_);\n return publicClient_;\n }\n setPublicClient(publicClient) {\n const chainId = this.data?.chain?.id;\n this.args = {\n ...this.args,\n publicClient\n };\n this.publicClients.clear();\n this.setState((x) => ({\n ...x,\n publicClient: this.getPublicClient({ chainId })\n }));\n }\n getWebSocketPublicClient({ chainId } = {}) {\n let webSocketPublicClient_ = this.webSocketPublicClients.get(-1);\n if (webSocketPublicClient_ && webSocketPublicClient_?.chain.id === chainId)\n return webSocketPublicClient_;\n webSocketPublicClient_ = this.webSocketPublicClients.get(chainId ?? -1);\n if (webSocketPublicClient_)\n return webSocketPublicClient_;\n const { webSocketPublicClient } = this.args;\n webSocketPublicClient_ = typeof webSocketPublicClient === \"function\" ? webSocketPublicClient({ chainId }) : webSocketPublicClient;\n if (webSocketPublicClient_)\n this.webSocketPublicClients.set(chainId ?? -1, webSocketPublicClient_);\n return webSocketPublicClient_;\n }\n setWebSocketPublicClient(webSocketPublicClient) {\n const chainId = this.data?.chain?.id;\n this.args = {\n ...this.args,\n webSocketPublicClient\n };\n this.webSocketPublicClients.clear();\n this.setState((x) => ({\n ...x,\n webSocketPublicClient: this.getWebSocketPublicClient({\n chainId\n })\n }));\n }\n setLastUsedConnector(lastUsedConnector = null) {\n this.storage?.setItem(\"wallet\", lastUsedConnector);\n }\n};\n_isAutoConnecting = new WeakMap();\n_lastUsedConnector = new WeakMap();\n_addEffects = new WeakSet();\naddEffects_fn = function() {\n const onChange = (data) => {\n this.setState((x) => ({\n ...x,\n data: { ...x.data, ...data }\n }));\n };\n const onDisconnect = () => {\n this.clearState();\n };\n const onError = (error) => {\n this.setState((x) => ({ ...x, error }));\n };\n this.store.subscribe(\n ({ connector }) => connector,\n (connector, prevConnector) => {\n prevConnector?.off?.(\"change\", onChange);\n prevConnector?.off?.(\"disconnect\", onDisconnect);\n prevConnector?.off?.(\"error\", onError);\n if (!connector)\n return;\n connector.on?.(\"change\", onChange);\n connector.on?.(\"disconnect\", onDisconnect);\n connector.on?.(\"error\", onError);\n }\n );\n const { publicClient, webSocketPublicClient } = this.args;\n const subscribePublicClient = typeof publicClient === \"function\";\n const subscribeWebSocketPublicClient = typeof webSocketPublicClient === \"function\";\n if (subscribePublicClient || subscribeWebSocketPublicClient)\n this.store.subscribe(\n ({ data }) => data?.chain?.id,\n (chainId) => {\n this.setState((x) => ({\n ...x,\n publicClient: this.getPublicClient({ chainId }),\n webSocketPublicClient: this.getWebSocketPublicClient({\n chainId\n })\n }));\n }\n );\n};\nvar config;\nfunction createConfig(args) {\n const config_ = new Config(args);\n config = config_;\n return config_;\n}\nfunction getConfig() {\n if (!config) {\n throw new Error(\n \"No wagmi config found. Ensure you have set up a config: https://wagmi.sh/react/config\"\n );\n }\n return config;\n}\n\n// src/actions/accounts/connect.ts\nasync function connect({ chainId, connector }) {\n const config2 = getConfig();\n const activeConnector = config2.connector;\n if (activeConnector && connector.id === activeConnector.id)\n throw new ConnectorAlreadyConnectedError();\n try {\n config2.setState((x) => ({ ...x, status: \"connecting\" }));\n const data = await connector.connect({ chainId });\n config2.setLastUsedConnector(connector.id);\n config2.setState((x) => ({\n ...x,\n connector,\n chains: connector?.chains,\n data,\n status: \"connected\"\n }));\n config2.storage.setItem(\"connected\", true);\n return { ...data, connector };\n } catch (err) {\n config2.setState((x) => {\n return {\n ...x,\n status: x.connector ? \"connected\" : \"disconnected\"\n };\n });\n throw err;\n }\n}\n\n// src/actions/accounts/disconnect.ts\nasync function disconnect() {\n const config2 = getConfig();\n if (config2.connector)\n await config2.connector.disconnect();\n config2.clearState();\n config2.storage.removeItem(\"connected\");\n}\n\n// src/actions/accounts/fetchBalance.ts\nimport {\n ContractFunctionExecutionError as ContractFunctionExecutionError3,\n formatUnits as formatUnits2,\n hexToString as hexToString2,\n trim as trim2\n} from \"viem\";\n\n// src/constants/abis.ts\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"uint256\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"decimals\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint8\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"name\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"string\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"symbol\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"string\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"totalSupply\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"bool\"\n }\n ]\n }\n];\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"uint256\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"decimals\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint8\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"name\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"symbol\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"totalSupply\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"bool\"\n }\n ]\n }\n];\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"bool\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"name\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"string\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"totalSupply\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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];\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\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\n// src/actions/contracts/fetchToken.ts\nimport {\n ContractFunctionExecutionError,\n formatUnits,\n hexToString,\n trim\n} from \"viem\";\nasync function fetchToken({\n address,\n chainId,\n formatUnits: unit = 18\n}) {\n async function fetchToken_({ abi }) {\n const erc20Config = { address, abi, chainId };\n const [decimals, name, symbol, totalSupply] = await readContracts({\n allowFailure: false,\n contracts: [\n { ...erc20Config, functionName: \"decimals\" },\n { ...erc20Config, functionName: \"name\" },\n { ...erc20Config, functionName: \"symbol\" },\n { ...erc20Config, functionName: \"totalSupply\" }\n ]\n });\n return {\n address,\n decimals,\n name,\n symbol,\n totalSupply: {\n formatted: formatUnits(totalSupply, getUnit(unit)),\n value: totalSupply\n }\n };\n }\n try {\n return await fetchToken_({ abi: erc20ABI });\n } catch (err) {\n if (err instanceof ContractFunctionExecutionError) {\n const { name, symbol, ...rest } = await fetchToken_({\n abi: erc20ABI_bytes32\n });\n return {\n name: hexToString(trim(name, { dir: \"right\" })),\n symbol: hexToString(trim(symbol, { dir: \"right\" })),\n ...rest\n };\n }\n throw err;\n }\n}\n\n// src/actions/viem/getPublicClient.ts\nfunction getPublicClient({ chainId } = {}) {\n const config2 = getConfig();\n if (chainId)\n return config2.getPublicClient({ chainId }) || config2.publicClient;\n return config2.publicClient;\n}\n\n// src/actions/viem/getWalletClient.ts\nasync function getWalletClient({\n chainId\n} = {}) {\n const config2 = getConfig();\n const walletClient = await config2.connector?.getWalletClient?.({ chainId }) || null;\n return walletClient;\n}\n\n// src/actions/viem/getWebSocketPublicClient.ts\nfunction getWebSocketPublicClient({\n chainId\n} = {}) {\n const config2 = getConfig();\n if (chainId)\n return config2.getWebSocketPublicClient({ chainId }) || config2.webSocketPublicClient;\n return config2.webSocketPublicClient;\n}\n\n// src/actions/viem/watchPublicClient.ts\nfunction watchPublicClient(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(getPublicClient(args));\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return unsubscribe;\n}\n\n// src/actions/viem/watchWalletClient.ts\nimport { shallow } from \"zustand/shallow\";\nfunction watchWalletClient({ chainId }, callback) {\n const config2 = getConfig();\n const handleChange = async ({ chainId: chainId_ }) => {\n if (chainId && chainId_ && chainId !== chainId_)\n return;\n const walletClient = await getWalletClient({ chainId });\n if (!getConfig().connector)\n return callback(null);\n return callback(walletClient);\n };\n const unsubscribe = config2.subscribe(\n ({ data, connector }) => ({\n account: data?.account,\n chainId: data?.chain?.id,\n connector\n }),\n handleChange,\n {\n equalityFn: shallow\n }\n );\n return unsubscribe;\n}\n\n// src/actions/viem/watchWebSocketPublicClient.ts\nfunction watchWebSocketPublicClient(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(getWebSocketPublicClient(args));\n const unsubscribe = config2.subscribe(\n ({ webSocketPublicClient }) => webSocketPublicClient,\n handleChange\n );\n return unsubscribe;\n}\n\n// src/actions/contracts/prepareWriteContract.ts\nasync function prepareWriteContract({\n abi,\n address,\n args,\n chainId,\n dataSuffix,\n functionName,\n walletClient: walletClient_,\n ...config2\n}) {\n const publicClient = getPublicClient({ chainId });\n const walletClient = walletClient_ ?? await getWalletClient({ chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (chainId)\n assertActiveChain({ chainId });\n const {\n account,\n accessList,\n blockNumber,\n blockTag,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n value\n } = getCallParameters(config2);\n const { result, request } = await publicClient.simulateContract({\n abi,\n address,\n functionName,\n args,\n account: account || walletClient.account,\n accessList,\n blockNumber,\n blockTag,\n dataSuffix,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n value\n });\n const minimizedAbi = abi.filter(\n (abiItem) => \"name\" in abiItem && abiItem.name === functionName\n );\n return {\n mode: \"prepared\",\n request: {\n ...request,\n abi: minimizedAbi,\n chainId\n },\n result\n };\n}\n\n// src/actions/contracts/getContract.ts\nimport { getContract as getContract_ } from \"viem\";\nfunction getContract({\n address,\n abi,\n chainId,\n walletClient\n}) {\n const publicClient = getPublicClient({ chainId });\n return getContract_({\n address,\n abi,\n publicClient,\n walletClient\n });\n}\n\n// src/actions/contracts/multicall.ts\nasync function multicall({\n chainId,\n contracts,\n blockNumber,\n blockTag,\n ...args\n}) {\n const publicClient = getPublicClient({ chainId });\n if (!publicClient.chains)\n throw new ConfigChainsNotFound();\n if (chainId && publicClient.chain.id !== chainId)\n throw new ChainNotConfiguredError({ chainId });\n return publicClient.multicall({\n allowFailure: args.allowFailure ?? true,\n blockNumber,\n blockTag,\n contracts\n });\n}\n\n// src/actions/contracts/readContract.ts\nasync function readContract({\n address,\n account,\n chainId,\n abi,\n args,\n functionName,\n blockNumber,\n blockTag\n}) {\n const publicClient = getPublicClient({ chainId });\n return publicClient.readContract({\n abi,\n address,\n account,\n functionName,\n args,\n blockNumber,\n blockTag\n });\n}\n\n// src/actions/contracts/readContracts.ts\nimport { ContractFunctionExecutionError as ContractFunctionExecutionError2 } from \"viem\";\nasync function readContracts({\n contracts,\n blockNumber,\n blockTag,\n ...args\n}) {\n const { allowFailure = true } = args;\n try {\n const publicClient = getPublicClient();\n const contractsByChainId = contracts.reduce((contracts2, contract, index) => {\n const chainId = contract.chainId ?? publicClient.chain.id;\n return {\n ...contracts2,\n [chainId]: [...contracts2[chainId] || [], { contract, index }]\n };\n }, {});\n const promises = () => Object.entries(contractsByChainId).map(\n ([chainId, contracts2]) => multicall({\n allowFailure,\n chainId: parseInt(chainId),\n contracts: contracts2.map(\n ({ contract }) => contract\n ),\n blockNumber,\n blockTag\n })\n );\n const multicallResults = (await Promise.all(promises())).flat();\n const resultIndexes = Object.values(contractsByChainId).flatMap(\n (contracts2) => contracts2.map(({ index }) => index)\n );\n return multicallResults.reduce((results, result, index) => {\n if (results)\n results[resultIndexes[index]] = result;\n return results;\n }, []);\n } catch (err) {\n if (err instanceof ContractFunctionExecutionError2)\n throw err;\n const promises = () => contracts.map(\n (contract) => readContract({ ...contract, blockNumber, blockTag })\n );\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: void 0, status: \"failure\" };\n });\n return await Promise.all(promises());\n }\n}\n\n// src/actions/contracts/watchContractEvent.ts\nimport { shallow as shallow2 } from \"zustand/shallow\";\nfunction watchContractEvent({\n address,\n abi,\n chainId,\n eventName\n}, callback) {\n let unwatch;\n const watchEvent = async () => {\n if (unwatch)\n unwatch();\n const publicClient = getWebSocketPublicClient({ chainId }) || getPublicClient({ chainId });\n unwatch = publicClient.watchContractEvent({\n address,\n abi,\n eventName,\n onLogs: callback\n });\n };\n watchEvent();\n const config2 = getConfig();\n const unsubscribe = config2.subscribe(\n ({ publicClient, webSocketPublicClient }) => ({\n publicClient,\n webSocketPublicClient\n }),\n watchEvent,\n { equalityFn: shallow2 }\n );\n return () => {\n unwatch?.();\n unsubscribe();\n };\n}\n\n// src/actions/network-status/watchBlockNumber.ts\nimport { shallow as shallow3 } from \"zustand/shallow\";\nfunction watchBlockNumber(args, callback) {\n let unwatch;\n const createListener = (publicClient) => {\n if (unwatch)\n unwatch();\n unwatch = publicClient.watchBlockNumber({\n onBlockNumber: callback,\n emitOnBegin: true,\n poll: true\n });\n };\n const publicClient_ = getWebSocketPublicClient({ chainId: args.chainId }) ?? getPublicClient({ chainId: args.chainId });\n if (args.listen)\n createListener(publicClient_);\n const config2 = getConfig();\n const unsubscribe = config2.subscribe(\n ({ publicClient, webSocketPublicClient }) => ({\n publicClient,\n webSocketPublicClient\n }),\n async ({ publicClient, webSocketPublicClient }) => {\n const publicClient_2 = webSocketPublicClient ?? publicClient;\n if (args.listen && !args.chainId && publicClient_2) {\n createListener(publicClient_2);\n }\n },\n {\n equalityFn: shallow3\n }\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/watchMulticall.ts\nfunction watchMulticall(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(await multicall(args));\n const unwatch = args.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : void 0;\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/watchReadContract.ts\nfunction watchReadContract(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(await readContract(args));\n const unwatch = args.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : void 0;\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/watchReadContracts.ts\nfunction watchReadContracts(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(await readContracts(args));\n const unwatch = args.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : void 0;\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/writeContract.ts\nasync function writeContract(config2) {\n const walletClient = await getWalletClient({ chainId: config2.chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (config2.chainId)\n assertActiveChain({ chainId: config2.chainId });\n let request;\n if (config2.mode === \"prepared\") {\n request = config2.request;\n } else {\n const { chainId: _, mode: __, ...args } = config2;\n const res = await prepareWriteContract(args);\n request = res.request;\n }\n const hash = await walletClient.writeContract({\n ...request,\n chain: config2.chainId ? { id: config2.chainId } : null\n });\n return { hash };\n}\n\n// src/actions/accounts/fetchBalance.ts\nasync function fetchBalance({\n address,\n chainId,\n formatUnits: unit,\n token\n}) {\n const config2 = getConfig();\n const publicClient = getPublicClient({ chainId });\n if (token) {\n const fetchContractBalance = async ({ abi }) => {\n const erc20Config = { abi, address: token, chainId };\n const [value2, decimals, symbol] = await readContracts({\n allowFailure: false,\n contracts: [\n {\n ...erc20Config,\n functionName: \"balanceOf\",\n args: [address]\n },\n { ...erc20Config, functionName: \"decimals\" },\n { ...erc20Config, functionName: \"symbol\" }\n ]\n });\n return {\n decimals,\n formatted: formatUnits2(value2 ?? \"0\", getUnit(unit ?? decimals)),\n symbol,\n value: value2\n };\n };\n try {\n return await fetchContractBalance({ abi: erc20ABI });\n } catch (err) {\n if (err instanceof ContractFunctionExecutionError3) {\n const { symbol, ...rest } = await fetchContractBalance({\n abi: erc20ABI_bytes32\n });\n return {\n symbol: hexToString2(trim2(symbol, { dir: \"right\" })),\n ...rest\n };\n }\n throw err;\n }\n }\n const chains = [\n ...config2.publicClient.chains || [],\n ...config2.chains ?? []\n ];\n const value = await publicClient.getBalance({ address });\n const chain = chains.find((x) => x.id === publicClient.chain.id);\n return {\n decimals: chain?.nativeCurrency.decimals ?? 18,\n formatted: formatUnits2(value ?? \"0\", getUnit(unit ?? 18)),\n symbol: chain?.nativeCurrency.symbol ?? \"ETH\",\n value\n };\n}\n\n// src/actions/accounts/getAccount.ts\nfunction getAccount() {\n const { data, connector, status } = getConfig();\n switch (status) {\n case \"connected\":\n return {\n address: data?.account,\n connector,\n isConnected: true,\n isConnecting: false,\n isDisconnected: false,\n isReconnecting: false,\n status\n };\n case \"reconnecting\":\n return {\n address: data?.account,\n connector,\n isConnected: !!data?.account,\n isConnecting: false,\n isDisconnected: false,\n isReconnecting: true,\n status\n };\n case \"connecting\":\n return {\n address: data?.account,\n connector,\n isConnected: false,\n isConnecting: true,\n isDisconnected: false,\n isReconnecting: false,\n status\n };\n case \"disconnected\":\n return {\n address: void 0,\n connector: void 0,\n isConnected: false,\n isConnecting: false,\n isDisconnected: true,\n isReconnecting: false,\n status\n };\n }\n}\n\n// src/actions/accounts/getNetwork.ts\nfunction getNetwork() {\n const config2 = getConfig();\n const chainId = config2.data?.chain?.id;\n const activeChains = config2.chains ?? [];\n const activeChain = [\n ...config2.publicClient?.chains || [],\n ...activeChains\n ].find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${chainId}`,\n network: `${chainId}`,\n nativeCurrency: { name: \"Ether\", decimals: 18, symbol: \"ETH\" },\n rpcUrls: {\n default: { http: [\"\"] },\n public: { http: [\"\"] }\n }\n };\n return {\n chain: chainId ? {\n ...activeChain,\n ...config2.data?.chain,\n id: chainId\n } : void 0,\n chains: activeChains\n };\n}\n\n// src/actions/accounts/signMessage.ts\nasync function signMessage(args) {\n const walletClient = await getWalletClient();\n if (!walletClient)\n throw new ConnectorNotFoundError();\n return await walletClient.signMessage({\n message: args.message\n });\n}\n\n// src/actions/accounts/signTypedData.ts\nasync function signTypedData({\n domain,\n message,\n primaryType,\n types\n}) {\n const walletClient = await getWalletClient();\n if (!walletClient)\n throw new ConnectorNotFoundError();\n const { chainId } = domain;\n if (chainId)\n assertActiveChain({ chainId });\n return walletClient.signTypedData({\n message,\n primaryType,\n types,\n domain\n });\n}\n\n// src/actions/accounts/switchNetwork.ts\nasync function switchNetwork({\n chainId\n}) {\n const { connector } = getConfig();\n if (!connector)\n throw new ConnectorNotFoundError();\n if (!connector.switchChain)\n throw new SwitchChainNotSupportedError({\n connector\n });\n return connector.switchChain(chainId);\n}\n\n// src/actions/accounts/watchAccount.ts\nimport { shallow as shallow4 } from \"zustand/shallow\";\nfunction watchAccount(callback, { selector = (x) => x } = {}) {\n const config2 = getConfig();\n const handleChange = () => callback(getAccount());\n const unsubscribe = config2.subscribe(\n ({ data, connector, status }) => selector({\n address: data?.account,\n connector,\n status\n }),\n handleChange,\n {\n equalityFn: shallow4\n }\n );\n return unsubscribe;\n}\n\n// src/actions/accounts/watchNetwork.ts\nimport { shallow as shallow5 } from \"zustand/shallow\";\nfunction watchNetwork(callback, { selector = (x) => x } = {}) {\n const config2 = getConfig();\n const handleChange = () => callback(getNetwork());\n const unsubscribe = config2.subscribe(\n ({ data, chains }) => selector({ chainId: data?.chain?.id, chains }),\n handleChange,\n {\n equalityFn: shallow5\n }\n );\n return unsubscribe;\n}\n\n// src/actions/ens/fetchEnsAddress.ts\nimport { getAddress } from \"viem\";\nasync function fetchEnsAddress({\n chainId,\n name\n}) {\n const { normalize } = await import(\"viem/ens\");\n const publicClient = getPublicClient({ chainId });\n const address = await publicClient.getEnsAddress({\n name: normalize(name)\n });\n try {\n if (address === \"0x0000000000000000000000000000000000000000\")\n return null;\n return address ? getAddress(address) : null;\n } catch (_error) {\n return null;\n }\n}\n\n// src/actions/ens/fetchEnsAvatar.ts\nasync function fetchEnsAvatar({\n name,\n chainId\n}) {\n const { normalize } = await import(\"viem/ens\");\n const publicClient = getPublicClient({ chainId });\n const avatar = await publicClient.getEnsAvatar({ name: normalize(name) });\n return avatar;\n}\n\n// src/actions/ens/fetchEnsName.ts\nimport { getAddress as getAddress2 } from \"viem\";\nasync function fetchEnsName({\n address,\n chainId\n}) {\n const publicClient = getPublicClient({ chainId });\n return publicClient.getEnsName({\n address: getAddress2(address)\n });\n}\n\n// src/actions/ens/fetchEnsResolver.ts\nasync function fetchEnsResolver({\n chainId,\n name\n}) {\n const { normalize } = await import(\"viem/ens\");\n const publicClient = getPublicClient({ chainId });\n const resolver = await publicClient.getEnsResolver({ name: normalize(name) });\n return resolver;\n}\n\n// src/actions/network-status/fetchBlockNumber.ts\nasync function fetchBlockNumber({\n chainId\n} = {}) {\n const publicClient = getPublicClient({ chainId });\n const blockNumber = await publicClient.getBlockNumber();\n return blockNumber;\n}\n\n// src/actions/network-status/fetchFeeData.ts\nimport { formatUnits as formatUnits3, parseGwei } from \"viem\";\nasync function fetchFeeData({\n chainId,\n formatUnits: units = \"gwei\"\n} = {}) {\n const publicClient = getPublicClient({ chainId });\n const block = await publicClient.getBlock();\n let gasPrice = null;\n try {\n gasPrice = await publicClient.getGasPrice();\n } catch {\n }\n let lastBaseFeePerGas = null;\n let maxFeePerGas = null;\n let maxPriorityFeePerGas = null;\n if (block?.baseFeePerGas) {\n lastBaseFeePerGas = block.baseFeePerGas;\n maxPriorityFeePerGas = parseGwei(\"1\");\n maxFeePerGas = block.baseFeePerGas * 2n + maxPriorityFeePerGas;\n }\n const unit = getUnit(units);\n const formatted = {\n gasPrice: gasPrice ? formatUnits3(gasPrice, unit) : null,\n maxFeePerGas: maxFeePerGas ? formatUnits3(maxFeePerGas, unit) : null,\n maxPriorityFeePerGas: maxPriorityFeePerGas ? formatUnits3(maxPriorityFeePerGas, unit) : null\n };\n return {\n lastBaseFeePerGas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n formatted\n };\n}\n\n// src/actions/transactions/fetchTransaction.ts\nasync function fetchTransaction({\n chainId,\n hash\n}) {\n const publicClient = getPublicClient({ chainId });\n return publicClient.getTransaction({ hash });\n}\n\n// src/actions/transactions/prepareSendTransaction.ts\nimport { isAddress } from \"viem\";\nasync function prepareSendTransaction({\n accessList,\n account,\n chainId,\n data,\n gas: gas_,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to: to_,\n value,\n walletClient: walletClient_\n}) {\n const publicClient = getPublicClient({ chainId });\n const walletClient = walletClient_ ?? await getWalletClient({ chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (chainId)\n assertActiveChain({ chainId });\n const to = (to_ && !isAddress(to_) ? await fetchEnsAddress({ name: to_ }) : to_) || void 0;\n if (to && !isAddress(to))\n throw new Error(\"Invalid address\");\n const gas = typeof gas_ === \"undefined\" ? await publicClient.estimateGas({\n accessList,\n account: walletClient.account,\n data,\n gas: gas_ ?? void 0,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value\n }) : gas_ || void 0;\n return {\n accessList,\n account,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n mode: \"prepared\",\n nonce,\n to,\n value,\n ...chainId ? { chainId } : {}\n };\n}\n\n// src/actions/transactions/sendTransaction.ts\nasync function sendTransaction({\n accessList,\n account,\n chainId,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n mode,\n nonce,\n to,\n value\n}) {\n const walletClient = await getWalletClient({ chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (chainId)\n assertActiveChain({ chainId });\n let args;\n if (mode === \"prepared\") {\n args = {\n account,\n accessList,\n chain: null,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value\n };\n } else {\n args = await prepareSendTransaction({\n accessList,\n account,\n chainId,\n data,\n gas: gas || null,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value\n });\n }\n const hash = await walletClient.sendTransaction({\n ...args,\n chain: chainId ? { id: chainId } : null\n });\n return { hash };\n}\n\n// src/actions/transactions/waitForTransaction.ts\nimport { hexToString as hexToString3 } from \"viem\";\nasync function waitForTransaction({\n chainId,\n confirmations = 1,\n hash,\n onReplaced,\n timeout = 0\n}) {\n const publicClient = getPublicClient({ chainId });\n const receipt = await publicClient.waitForTransactionReceipt({\n hash,\n confirmations,\n onReplaced,\n timeout\n });\n if (receipt.status === \"reverted\") {\n const txn = await publicClient.getTransaction({\n hash: receipt.transactionHash\n });\n const code = await publicClient.call({\n ...txn,\n gasPrice: txn.type !== \"eip1559\" ? txn.gasPrice : void 0,\n maxFeePerGas: txn.type === \"eip1559\" ? txn.maxFeePerGas : void 0,\n maxPriorityFeePerGas: txn.type === \"eip1559\" ? txn.maxPriorityFeePerGas : void 0\n });\n const reason = hexToString3(`0x${code.substring(138)}`);\n throw new Error(reason);\n }\n return receipt;\n}\n\n// src/actions/transactions/watchPendingTransactions.ts\nimport { shallow as shallow6 } from \"zustand/shallow\";\nfunction watchPendingTransactions(args, callback) {\n let unwatch;\n const createListener = (publicClient) => {\n if (unwatch)\n unwatch();\n unwatch = publicClient.watchPendingTransactions({\n onTransactions: callback,\n poll: true\n });\n };\n const publicClient_ = getWebSocketPublicClient({ chainId: args.chainId }) ?? getPublicClient({ chainId: args.chainId });\n createListener(publicClient_);\n const config2 = getConfig();\n const unsubscribe = config2.subscribe(\n ({ publicClient, webSocketPublicClient }) => ({\n publicClient,\n webSocketPublicClient\n }),\n async ({ publicClient, webSocketPublicClient }) => {\n const publicClient_2 = webSocketPublicClient ?? publicClient;\n if (!args.chainId && publicClient_2) {\n createListener(publicClient_2);\n }\n },\n {\n equalityFn: shallow6\n }\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/utils/assertActiveChain.ts\nfunction assertActiveChain({ chainId }) {\n const { chain: activeChain, chains } = getNetwork();\n const activeChainId = activeChain?.id;\n if (activeChainId && chainId !== activeChainId) {\n throw new ChainMismatchError({\n activeChain: chains.find((x) => x.id === activeChainId)?.name ?? `Chain ${activeChainId}`,\n targetChain: chains.find((x) => x.id === chainId)?.name ?? `Chain ${chainId}`\n });\n }\n}\n\nexport {\n configureChains,\n ChainMismatchError,\n ChainNotConfiguredError,\n ConnectorAlreadyConnectedError,\n ConfigChainsNotFound,\n SwitchChainNotSupportedError,\n ConnectorNotFoundError,\n deepEqual,\n deserialize,\n getCallParameters,\n getSendTransactionParameters,\n getUnit,\n serialize,\n noopStorage,\n createStorage,\n Config,\n createConfig,\n getConfig,\n connect,\n disconnect,\n erc20ABI,\n erc721ABI,\n erc4626ABI,\n fetchToken,\n getPublicClient,\n getWalletClient,\n getWebSocketPublicClient,\n watchPublicClient,\n watchWalletClient,\n watchWebSocketPublicClient,\n prepareWriteContract,\n getContract,\n multicall,\n readContract,\n readContracts,\n watchContractEvent,\n watchBlockNumber,\n watchMulticall,\n watchReadContract,\n watchReadContracts,\n writeContract,\n fetchBalance,\n getAccount,\n getNetwork,\n signMessage,\n signTypedData,\n switchNetwork,\n watchAccount,\n watchNetwork,\n fetchEnsAddress,\n fetchEnsAvatar,\n fetchEnsName,\n fetchEnsResolver,\n fetchBlockNumber,\n fetchFeeData,\n fetchTransaction,\n prepareSendTransaction,\n sendTransaction,\n waitForTransaction,\n watchPendingTransactions\n};\n","import { MockProvider, MockProviderOptions } from '@wagmi/connectors/mock';\nimport { Connector, ConnectorData, WalletClient } from '@wagmi/core';\nimport { createWalletClient, getAddress, Hex, http, zeroAddress } from 'viem';\nimport type { Chain } from 'viem/chains';\nimport { mainnet } from 'viem/chains';\n\nexport function normalizeChainId(chainId: string | number | bigint) {\n if (typeof chainId === 'string')\n return Number.parseInt(\n chainId,\n chainId.trim().substring(0, 2) === '0x' ? 16 : 10,\n );\n if (typeof chainId === 'bigint') return Number(chainId);\n return chainId;\n}\n\ntype MockConnectorOptions = Omit<\n MockProviderOptions,\n 'chainId' | 'walletClient'\n> & {\n chainId?: number;\n};\n\nexport class ImpersonatedConnector extends Connector<\n MockProvider,\n MockConnectorOptions\n> {\n readonly id = 'impersonated';\n readonly name = 'Impersonated';\n readonly ready = true;\n private accountAddress: Hex;\n\n #provider?: MockProvider;\n\n constructor({\n chains,\n options,\n }: {\n chains?: Chain[];\n options: MockConnectorOptions;\n }) {\n super({\n chains,\n options: {\n ...options,\n chainId: options.chainId ?? chains?.[0]?.id,\n },\n });\n this.accountAddress = zeroAddress;\n }\n\n setAccountAddress(address: Hex | undefined) {\n this.accountAddress = address || zeroAddress;\n }\n\n async connect({ chainId }: { address?: Hex; chainId?: number } = {}) {\n const provider = await this.getProvider({\n address: this.accountAddress,\n chainId,\n });\n provider.on('accountsChanged', this.onAccountsChanged);\n provider.on('chainChanged', this.onChainChanged);\n provider.on('disconnect', this.onDisconnect);\n\n this.emit('message', { type: 'connecting' });\n\n const accounts = await provider.enable();\n const account = getAddress(accounts[0] as string);\n const id = normalizeChainId(provider.chainId);\n const unsupported = this.isChainUnsupported(id);\n const data = { account, chain: { id, unsupported }, provider };\n\n if (!this.options.flags?.noSwitchChain)\n this.switchChain = this.#switchChain;\n\n return new Promise>((res) =>\n setTimeout(() => res(data), 100),\n );\n }\n\n async disconnect() {\n const provider = await this.getProvider();\n await provider.disconnect();\n\n provider.removeListener('accountsChanged', this.onAccountsChanged);\n provider.removeListener('chainChanged', this.onChainChanged);\n provider.removeListener('disconnect', this.onDisconnect);\n }\n\n async getAccount() {\n const provider = await this.getProvider();\n const accounts = await provider.getAccounts();\n const account = accounts[0];\n if (!account) throw new Error('Failed to get account');\n // return checksum address\n return getAddress(account);\n }\n\n async getChainId() {\n const provider = await this.getProvider();\n return normalizeChainId(provider.chainId);\n }\n\n async getProvider({\n address,\n chainId,\n }: { address?: Hex; chainId?: number } = {}) {\n console.log('address', address);\n if (!this.#provider || chainId)\n this.#provider = new MockProvider({\n ...this.options,\n chainId: chainId ?? this.options.chainId ?? this.chains[0]!.id,\n walletClient: createWalletClient({\n account: address || zeroAddress,\n chain: this.chains.find((chain) => chain.id === chainId) || mainnet,\n transport: http(),\n }),\n });\n return this.#provider;\n }\n\n async getWalletClient(): Promise {\n const provider = await this.getProvider();\n return provider.getWalletClient();\n }\n\n async isAuthorized() {\n try {\n const provider = await this.getProvider();\n const account = await provider.getAccounts();\n return this.options.flags?.isAuthorized ?? !!account;\n } catch {\n return false;\n }\n }\n\n async #switchChain(chainId: number) {\n const provider = await this.getProvider();\n await provider.switchChain(chainId);\n return (\n this.chains.find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${chainId}`,\n network: `${chainId}`,\n nativeCurrency: { name: 'Ether', decimals: 18, symbol: 'ETH' },\n rpcUrls: { default: { http: [''] }, public: { http: [''] } },\n }\n );\n }\n\n async watchAsset(asset: {\n address: string;\n decimals?: number;\n image?: string;\n symbol: string;\n }) {\n const provider = await this.getProvider();\n return provider.watchAsset(asset);\n }\n\n protected onAccountsChanged = (accounts: string[]) => {\n if (accounts.length === 0) this.emit('disconnect');\n else this.emit('change', { account: getAddress(accounts[0] as string) });\n };\n\n protected onChainChanged = (chainId: number | string) => {\n const id = normalizeChainId(chainId);\n const unsupported = this.isChainUnsupported(id);\n this.emit('change', { chain: { id, unsupported } });\n };\n\n protected onDisconnect = () => {\n this.emit('disconnect');\n };\n\n toJSON() {\n return '';\n }\n}\n","import {\n configureChains,\n createConfig,\n GetAccountResult,\n watchAccount,\n watchNetwork,\n} from '@wagmi/core';\nimport React, { useEffect, useState } from 'react';\nimport { Chain } from 'viem';\nimport { publicProvider } from 'wagmi/providers/public';\nimport { StoreApi, UseBoundStore } from 'zustand';\n\nimport {\n AllConnectorsInitProps,\n ConnectorType,\n initAllConnectors,\n} from '../connectors';\n\ninterface WagmiProviderProps {\n useStore: UseBoundStore<\n StoreApi<{\n changeActiveWalletAccount: (account?: GetAccountResult) => Promise;\n changeActiveWalletChain: (chain?: Chain) => Promise;\n setConnectors: (connectors: ConnectorType[]) => void;\n }>\n >;\n connectorsInitProps: AllConnectorsInitProps;\n}\n\nfunction Child({\n useStore,\n connectors,\n}: Omit & {\n connectors: ConnectorType[];\n}) {\n const { setConnectors, changeActiveWalletAccount, changeActiveWalletChain } =\n useStore();\n\n watchAccount(async (data) => {\n if (data.address) {\n await changeActiveWalletAccount(data);\n }\n });\n watchNetwork(async (data) => {\n if (data.chain?.id) {\n await changeActiveWalletChain(data.chain);\n }\n });\n\n useEffect(() => {\n if (connectors) {\n setConnectors(connectors);\n }\n }, [connectors]);\n\n return null;\n}\n\nexport function WagmiProvider({\n useStore,\n connectorsInitProps,\n}: WagmiProviderProps) {\n const [connectors] = useState(initAllConnectors(connectorsInitProps));\n const [mappedConnectors] = useState(\n connectors.map((connector) => connector),\n );\n\n const { publicClient } = configureChains(\n Object.values(connectorsInitProps.chains),\n [publicProvider()],\n );\n\n createConfig({\n autoConnect: false,\n publicClient,\n connectors,\n });\n\n return ;\n}\n","import { Draft, produce } from 'immer';\nimport { Hex, PublicClient } from 'viem';\n\nimport { StoreSlice } from '../../types/store';\nimport {\n getLocalStorageTxPool,\n setLocalStorageTxPool,\n} from '../../utils/localStorage';\nimport { EthereumAdapter } from '../adapters/EthereumAdapter';\nimport {\n GelatoAdapter,\n GelatoTx,\n GelatoTXState,\n isGelatoBaseTx,\n isGelatoBaseTxWithoutTimestamp,\n isGelatoTx,\n} from '../adapters/GelatoAdapter';\nimport { GnosisAdapter } from '../adapters/GnosisAdapter';\nimport { AdapterInterface } from '../adapters/interface';\nimport { WalletType } from '../connectors';\nimport { IWalletSlice } from './walletSlice';\n\nexport type BaseTx = EthBaseTx | GelatoBaseTx;\n\nexport type InitialTx = Hex | GelatoTx;\nexport type NewTx = { hash: Hex } | GelatoTx;\n\ntype BasicTx = {\n chainId: number;\n type: string;\n from: Hex;\n payload?: object;\n localTimestamp: number;\n timestamp?: number;\n errorMessage?: string;\n};\n\nexport type EthBaseTx = BasicTx & {\n hash: Hex;\n to: Hex;\n nonce: number;\n};\n\nexport type GelatoBaseTx = BasicTx & {\n taskId: string;\n hash?: Hex;\n gelatoStatus?: GelatoTXState;\n};\n\nexport type ClientsRecord = Record;\n\nexport type TransactionsSliceBaseType = {\n clients: ClientsRecord;\n setClient: (chainId: number, client: PublicClient) => void;\n initTxPool: () => void;\n updateEthAdapter: (gnosis: boolean) => void;\n};\n\nexport type TransactionPool = Record;\n\ntype PoolTx = T & {\n status?: number;\n pending: boolean;\n walletType: WalletType;\n};\n\nexport interface ITransactionsState {\n transactionsPool: TransactionPool>;\n transactionsIntervalsMap: Record;\n}\n\nexport interface ITransactionsActions {\n gelatoAdapter: AdapterInterface;\n ethereumAdapter: AdapterInterface;\n txStatusChangedCallback: (\n data: T & {\n status?: number;\n timestamp?: number;\n },\n ) => void;\n executeTx: (params: {\n body: () => Promise;\n params: {\n type: T['type'];\n payload: T['payload'];\n desiredChainID: number;\n };\n }) => Promise<\n T & {\n status?: number;\n pending: boolean;\n }\n >;\n addTXToPool: (\n tx:\n | Omit\n | Omit,\n activeWallet: WalletType,\n ) => TransactionPool>;\n isGelatoAvailable: boolean;\n checkIsGelatoAvailable: (chainId: number) => Promise;\n updateEthAdapter: (gnosis: boolean) => void;\n}\n\nexport type ITransactionsSlice = ITransactionsActions &\n ITransactionsState &\n TransactionsSliceBaseType;\n\nexport function createTransactionsSlice({\n txStatusChangedCallback,\n defaultClients,\n}: {\n txStatusChangedCallback: (tx: T) => void;\n defaultClients: ClientsRecord;\n}): StoreSlice<\n ITransactionsSlice,\n Pick\n> {\n return (set, get) => ({\n transactionsPool: {},\n transactionsIntervalsMap: {},\n clients: defaultClients,\n txStatusChangedCallback,\n gelatoAdapter: new GelatoAdapter(get, set), // TODO: think when to init, maybe only when working with gelato or it's available\n ethereumAdapter: new EthereumAdapter(get, set), // This might be a Gnosis Safe adapter, re-inits when wallet.type === GnosisSafe\n executeTx: async ({ body, params }) => {\n await get().checkAndSwitchNetwork(params.desiredChainID);\n const activeWallet = get().activeWallet;\n if (!activeWallet) {\n throw new Error('No wallet connected');\n }\n\n const chainId = Number(params.desiredChainID);\n\n const tx: InitialTx = await body();\n const args = {\n tx: isGelatoTx(tx) ? tx : { hash: tx },\n payload: params.payload,\n activeWallet,\n chainId,\n type: params.type,\n };\n\n return isGelatoTx(tx) // in case of gnosis safe it works in a same way\n ? get().gelatoAdapter.executeTx(args)\n : get().ethereumAdapter.executeTx(args);\n },\n\n addTXToPool: (transaction, walletType) => {\n const localTimestamp = new Date().getTime();\n if (isGelatoBaseTxWithoutTimestamp(transaction)) {\n set((state) =>\n produce(state, (draft) => {\n draft.transactionsPool[transaction.taskId] = {\n ...transaction,\n pending: true,\n walletType,\n localTimestamp,\n } as Draft<\n T & {\n pending: boolean;\n walletType: WalletType;\n localTimestamp: number;\n }\n >;\n }),\n );\n\n const txPool = get().transactionsPool;\n setLocalStorageTxPool(txPool);\n } else {\n set((state) =>\n produce(state, (draft) => {\n draft.transactionsPool[transaction.hash] = {\n ...transaction,\n pending: true,\n walletType,\n localTimestamp,\n } as Draft<\n T & {\n pending: boolean;\n walletType: WalletType;\n }\n >;\n }),\n );\n }\n const txPool = get().transactionsPool;\n setLocalStorageTxPool(txPool);\n return txPool;\n },\n\n initTxPool: () => {\n const localStorageTXPool = getLocalStorageTxPool();\n if (localStorageTXPool) {\n const transactionsPool = JSON.parse(localStorageTXPool);\n // TODO: figure out type casting from string via ZOD or similar\n set(() => ({\n transactionsPool,\n }));\n }\n Object.values(get().transactionsPool).forEach((tx) => {\n if (tx.pending) {\n if (isGelatoBaseTx(tx)) {\n get().gelatoAdapter.startTxTracking(tx.taskId);\n } else {\n if (tx.hash) {\n get().ethereumAdapter.startTxTracking(tx.hash);\n }\n }\n }\n });\n },\n\n setClient: (chainId, client) => {\n const stateClients = get().clients;\n const updatedClients = (stateClients[chainId] = client);\n set({ clients: updatedClients });\n },\n\n isGelatoAvailable: true,\n checkIsGelatoAvailable: async (chainId) => {\n try {\n const response = await fetch(`https://relay.gelato.digital/relays/v2`);\n if (!response.ok) {\n set({ isGelatoAvailable: false });\n } else {\n const listOfRelays = (await response.json()) as { relays: string[] };\n const isRelayAvailable = !!listOfRelays.relays.find(\n (id) => +id === chainId,\n );\n set({ isGelatoAvailable: isRelayAvailable });\n }\n } catch (e) {\n set({ isGelatoAvailable: false });\n console.error(e);\n }\n },\n updateEthAdapter: (gnosis: boolean) => {\n set((state) =>\n produce(state, (draft) => {\n draft.ethereumAdapter = gnosis\n ? new GnosisAdapter(get, set)\n : new EthereumAdapter(get, set);\n }),\n );\n },\n });\n}\n","import { produce } from 'immer';\nimport { GetTransactionReturnType, Hex, PublicClient } from 'viem';\n\nimport { setLocalStorageTxPool } from '../../utils/localStorage';\nimport { BaseTx, ITransactionsSlice, NewTx } from '../store/transactionsSlice';\nimport { Wallet } from '../store/walletSlice';\nimport { AdapterInterface } from './interface';\n\nexport class EthereumAdapter implements AdapterInterface {\n get: () => ITransactionsSlice;\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void;\n transactionsIntervalsMap: Record = {};\n\n constructor(\n get: () => ITransactionsSlice,\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void,\n ) {\n this.get = get;\n this.set = set;\n }\n\n executeTx = async (params: {\n tx: NewTx;\n activeWallet: Wallet;\n payload: object | undefined;\n chainId: number;\n type: T['type'];\n }): Promise => {\n const { activeWallet, chainId, type } = params;\n const tx = params.tx as GetTransactionReturnType;\n\n // ethereum tx\n const transaction = {\n chainId,\n hash: tx.hash,\n type,\n payload: params.payload,\n from: tx.from,\n to: tx.to as Hex,\n nonce: tx.nonce,\n };\n const txPool = this.get().addTXToPool(transaction, activeWallet.walletType);\n this.waitForTxReceipt(tx, tx.hash);\n return txPool[tx.hash];\n };\n startTxTracking = async (txKey: string) => {\n const retryCount = 5;\n const txData = this.get().transactionsPool[txKey];\n if (txData) {\n const client = this.get().clients[txData.chainId] as PublicClient;\n\n if (txData.hash) {\n // Find the transaction in the waiting pool\n for (let i = 0; i < retryCount; i++) {\n const tx = await client.getTransaction({ hash: txData.hash });\n // If the transaction is found, wait for the receipt\n if (tx) {\n await this.waitForTxReceipt(tx, txData.hash);\n return; // Exit the function if successful\n }\n }\n // Wait before the next retry\n await new Promise((resolve) => setTimeout(resolve, 3000));\n }\n } else {\n // TODO: no transaction in waiting pool\n }\n };\n\n private waitForTxReceipt = async (\n tx: GetTransactionReturnType,\n txHash: Hex,\n ) => {\n const chainId = tx.chainId || this.get().transactionsPool[txHash].chainId;\n const client = this.get().clients[chainId] as PublicClient;\n\n try {\n // TODO: need added onReplaced logic\n const txn = await client.waitForTransactionReceipt({ hash: tx.hash });\n this.updateTXStatus(txHash, txn.status);\n\n const updatedTX = this.get().transactionsPool[txHash];\n const txBlock = await client.getBlock({ blockNumber: txn.blockNumber });\n const timestamp = txBlock.timestamp;\n this.get().txStatusChangedCallback({\n ...updatedTX,\n timestamp,\n });\n } catch (e) {\n console.error(e);\n }\n };\n\n private updateTXStatus = (hash: string, status?: 'success' | 'reverted') => {\n this.set((state) =>\n produce(state, (draft) => {\n draft.transactionsPool[hash].status =\n status === 'success'\n ? 1\n : draft.transactionsPool[hash].pending\n ? undefined\n : 0;\n draft.transactionsPool[hash].pending = false;\n }),\n );\n setLocalStorageTxPool(this.get().transactionsPool);\n };\n}\n","import dayjs from 'dayjs';\nimport { produce } from 'immer';\nimport { GetTransactionReturnType, Hex } from 'viem';\n\nimport { SafeTransactionServiceUrls } from '../../utils/constants';\nimport { setLocalStorageTxPool } from '../../utils/localStorage';\nimport {\n BaseTx,\n EthBaseTx,\n ITransactionsSlice,\n NewTx,\n} from '../store/transactionsSlice';\nimport { Wallet } from '../store/walletSlice';\nimport { AdapterInterface } from './interface';\n\nexport type GnosisTxStatusResponse = {\n transactionHash: string;\n safeTxHash: string;\n isExecuted: boolean;\n isSuccessful: boolean | null;\n executionDate: string | null;\n submissionDate: string | null;\n modified: string;\n nonce: number;\n};\n\nexport class GnosisAdapter implements AdapterInterface {\n get: () => ITransactionsSlice;\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void;\n transactionsIntervalsMap: Record = {};\n\n constructor(\n get: () => ITransactionsSlice,\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void,\n ) {\n this.get = get;\n this.set = set;\n }\n\n executeTx = async (params: {\n tx: NewTx;\n activeWallet: Wallet;\n payload: object | undefined;\n chainId: number;\n type: T['type'];\n }): Promise => {\n const { activeWallet, chainId, type } = params;\n const tx = params.tx as GetTransactionReturnType;\n // ethereum tx\n const transaction = {\n chainId,\n hash: tx.hash,\n type,\n payload: params.payload,\n from: tx.from,\n to: tx.to as Hex,\n nonce: tx.nonce,\n };\n const txPool = this.get().addTXToPool(transaction, activeWallet.walletType);\n this.startTxTracking(tx.hash);\n return txPool[tx.hash];\n };\n\n startTxTracking = async (txKey: string) => {\n const tx = this.get().transactionsPool[txKey];\n const isPending = tx.pending;\n if (!isPending) {\n return;\n }\n this.stopPollingGnosisTXStatus(txKey);\n\n const newGnosisInterval = setInterval(() => {\n this.fetchGnosisTxStatus(txKey);\n // TODO: maybe change timeout or even stop tracking after some time (day/week)\n }, 10000);\n\n this.transactionsIntervalsMap[txKey] = Number(newGnosisInterval);\n };\n\n private fetchGnosisTxStatus = async (txKey: string) => {\n const tx = this.get().transactionsPool[txKey];\n const response = await fetch(\n `${\n SafeTransactionServiceUrls[tx.chainId]\n }/multisig-transactions/${txKey}/`,\n );\n if (!response.ok) {\n // TODO: handle error if need, for now just skipping and do nothing with failed response\n } else {\n const gnosisStatus = (await response.json()) as GnosisTxStatusResponse;\n const gnosisStatusModified = dayjs(gnosisStatus.modified);\n const currentTime = dayjs();\n // check if more than a day passed to stop polling\n const daysPassed = currentTime.diff(gnosisStatusModified, 'day');\n if (daysPassed >= 1) {\n this.updateGnosisTxStatus(txKey, gnosisStatus, true);\n this.stopPollingGnosisTXStatus(txKey);\n this.get().txStatusChangedCallback(tx);\n return;\n }\n\n const isPending = !gnosisStatus.isExecuted;\n this.updateGnosisTxStatus(txKey, gnosisStatus);\n if (!isPending) {\n this.stopPollingGnosisTXStatus(txKey);\n this.get().txStatusChangedCallback(tx);\n }\n }\n };\n\n private stopPollingGnosisTXStatus = (txKey: string) => {\n const currentInterval = this.transactionsIntervalsMap[txKey];\n clearInterval(currentInterval);\n this.transactionsIntervalsMap[txKey] = undefined;\n };\n\n private updateGnosisTxStatus = (\n txKey: string,\n statusResponse: GnosisTxStatusResponse,\n forceStopped?: boolean,\n ) => {\n this.set((state) =>\n produce(state, (draft) => {\n const tx = draft.transactionsPool[txKey] as EthBaseTx & {\n pending: boolean;\n status?: number;\n };\n tx.status = forceStopped ? 0 : +!!statusResponse.isSuccessful; // turns boolean | null to 0 or 1\n tx.pending = forceStopped ? false : !statusResponse.isExecuted;\n tx.nonce = statusResponse.nonce;\n }),\n );\n setLocalStorageTxPool(this.get().transactionsPool);\n };\n}\n","import {\n connect,\n disconnect,\n getAccount,\n GetAccountResult,\n getNetwork,\n getPublicClient,\n getWalletClient,\n} from '@wagmi/core';\nimport { produce } from 'immer';\nimport { Chain, Hex, PublicClient, WalletClient } from 'viem';\n\nimport { StoreSlice } from '../../types/store';\nimport {\n clearWalletConnectV2LocalStorage,\n clearWalletLinkLocalStorage,\n deleteLocalStorageWallet,\n LocalStorageKeys,\n setLocalStorageWallet,\n} from '../../utils/localStorage';\nimport { ConnectorType, getConnectorName, WalletType } from '../connectors';\nimport { ImpersonatedConnector } from '../connectors/ImpersonatedConnector';\nimport { TransactionsSliceBaseType } from './transactionsSlice';\n\nexport interface Wallet {\n walletType: WalletType;\n address: Hex;\n chain?: Chain;\n client: PublicClient;\n walletClient: WalletClient;\n // isActive is added, because Wallet can be connected but not active, i.e. wrong network\n isActive: boolean;\n // isContractAddress is added, to check if wallet address is contract\n isContractAddress: boolean;\n}\n\nexport type IWalletSlice = {\n isContractWalletRecord: Record;\n activeWallet?: Wallet;\n setActiveWallet: (\n wallet: Omit,\n ) => Promise;\n isActiveWalletSetting: boolean;\n connectWallet: (walletType: WalletType, chainId?: number) => Promise;\n disconnectActiveWallet: () => Promise;\n walletActivating: boolean;\n walletConnectionError: string;\n resetWalletConnectionError: () => void;\n initDefaultWallet: () => Promise;\n changeActiveWalletAccount: (account?: GetAccountResult) => Promise;\n isActiveWalletAccountChanging: boolean;\n changeActiveWalletChain: (chain?: Chain) => Promise;\n isActiveWalletChainChanging: boolean;\n checkAndSwitchNetwork: (chainId?: number) => Promise;\n connectors: ConnectorType[];\n setConnectors: (connectors: ConnectorType[]) => void;\n _impersonatedAddress?: Hex;\n setImpersonatedAddress: (address: Hex) => void;\n checkIsContractWallet: (\n wallet: Omit,\n ) => Promise;\n};\n\nexport function createWalletSlice({\n walletConnected,\n}: {\n walletConnected: (wallet: Wallet) => void;\n}): StoreSlice {\n return (set, get) => ({\n isContractWalletRecord: {},\n walletActivating: false,\n walletConnectionError: '',\n connectors: [],\n setConnectors: async (connectors) => {\n if (get().connectors.length !== connectors.length) {\n set(() => ({ connectors }));\n await get().initDefaultWallet();\n get().initTxPool();\n }\n },\n initDefaultWallet: async () => {\n const lastConnectedWallet = localStorage.getItem(\n LocalStorageKeys.LastConnectedWallet,\n ) as WalletType | undefined;\n\n if (lastConnectedWallet) {\n await get().connectWallet(lastConnectedWallet);\n }\n },\n\n setActiveWallet: async (wallet) => {\n if (wallet.isActive) {\n if (wallet.chain) {\n set({ isActiveWalletSetting: true });\n const client = getPublicClient({ chainId: wallet.chain.id });\n const walletClient = await getWalletClient({\n chainId: wallet.chain.id,\n });\n\n if (client && walletClient) {\n const walletWithClients = {\n ...wallet,\n walletClient,\n client,\n };\n\n const isContractAddress =\n await get().checkIsContractWallet(walletWithClients);\n const activeWallet = { ...walletWithClients, isContractAddress };\n\n set({ activeWallet });\n walletConnected(activeWallet);\n set({ isActiveWalletSetting: false });\n }\n }\n }\n },\n isActiveWalletSetting: false,\n\n connectWallet: async (walletType, chainId) => {\n clearWalletLinkLocalStorage();\n clearWalletConnectV2LocalStorage();\n\n if (get().activeWallet?.walletType !== walletType) {\n await get().disconnectActiveWallet();\n }\n\n set({ walletActivating: true });\n set({ walletConnectionError: '' });\n\n const connector = get().connectors.find(\n (connector) => getConnectorName(connector) === walletType,\n );\n\n try {\n if (connector) {\n if (connector instanceof ImpersonatedConnector) {\n connector.setAccountAddress(get()._impersonatedAddress);\n await connect({ connector, chainId });\n } else {\n await connect({ connector });\n }\n\n setLocalStorageWallet(walletType);\n get().updateEthAdapter(walletType === 'GnosisSafe');\n\n const account = getAccount();\n const network = getNetwork();\n if (\n account &&\n account.isConnected &&\n account.address &&\n network.chain\n ) {\n await get().setActiveWallet({\n walletType,\n address: account.address,\n chain: network.chain,\n isActive: account.isConnected,\n isContractAddress: false,\n });\n }\n }\n } catch (e) {\n if (e instanceof Error) {\n let errorMessage = e.message ? e.message.toString() : e.toString();\n set({\n walletConnectionError: errorMessage,\n });\n }\n console.error(e);\n }\n set({ walletActivating: false });\n },\n checkAndSwitchNetwork: async (chainId) => {\n const activeWallet = get().activeWallet;\n if (\n chainId &&\n activeWallet &&\n activeWallet.chain?.id &&\n activeWallet.chain.id !== chainId\n ) {\n set({ isActiveWalletSetting: true });\n await activeWallet.walletClient.switchChain({\n id: chainId,\n });\n await new Promise((resolve) => {\n function loop() {\n if (!get().isActiveWalletSetting) {\n return resolve(() =>\n console.info('Chain for wallet client changed'),\n );\n }\n setTimeout(loop, 10);\n }\n loop();\n });\n }\n },\n disconnectActiveWallet: async () => {\n await disconnect();\n set({ activeWallet: undefined });\n deleteLocalStorageWallet();\n clearWalletLinkLocalStorage();\n clearWalletConnectV2LocalStorage();\n },\n\n checkIsContractWallet: async (wallet) => {\n const address = wallet.address;\n const walletRecord = get().isContractWalletRecord[address];\n if (walletRecord !== undefined) {\n return walletRecord;\n }\n const codeOfWalletAddress = await wallet.client.getBytecode({\n address: wallet.address,\n });\n const isContractWallet = !!codeOfWalletAddress;\n set((state) =>\n produce(state, (draft) => {\n draft.isContractWalletRecord[address] = isContractWallet;\n }),\n );\n return isContractWallet;\n },\n\n changeActiveWalletAccount: async (account) => {\n const activeWallet = get().activeWallet;\n if (\n account &&\n account.address &&\n activeWallet &&\n activeWallet.isActive &&\n activeWallet.address !== account.address &&\n !get().isActiveWalletAccountChanging\n ) {\n set({ isActiveWalletAccountChanging: true });\n await get().setActiveWallet({\n walletType: activeWallet.walletType,\n address: account.address,\n isActive: activeWallet.isActive,\n isContractAddress: activeWallet.isContractAddress,\n chain: activeWallet.chain,\n });\n set({ isActiveWalletAccountChanging: false });\n }\n },\n isActiveWalletAccountChanging: false,\n changeActiveWalletChain: async (chain) => {\n const activeWallet = get().activeWallet;\n if (\n chain !== undefined &&\n activeWallet &&\n activeWallet.isActive &&\n activeWallet.chain &&\n activeWallet.chain.id !== chain.id &&\n !get().isActiveWalletChainChanging\n ) {\n set({ isActiveWalletChainChanging: true });\n await get().setActiveWallet({\n walletType: activeWallet.walletType,\n address: activeWallet.address,\n isActive: activeWallet.isActive,\n isContractAddress: activeWallet.isContractAddress,\n chain: chain,\n });\n set({ isActiveWalletChainChanging: false });\n }\n },\n isActiveWalletChainChanging: false,\n\n setImpersonatedAddress: (address) => {\n set({ _impersonatedAddress: address });\n },\n resetWalletConnectionError: () => {\n set({ walletConnectionError: '' });\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,iDAAAA,SAAA;AAAA;AAEA,QAAI,MAAM,OAAO,UAAU;AAA3B,QACI,SAAS;AASb,aAAS,SAAS;AAAA,IAAC;AASnB,QAAI,OAAO,QAAQ;AACjB,aAAO,YAAY,uBAAO,OAAO,IAAI;AAMrC,UAAI,CAAC,IAAI,OAAO,EAAE;AAAW,iBAAS;AAAA,IACxC;AAWA,aAAS,GAAG,IAAI,SAAS,MAAM;AAC7B,WAAK,KAAK;AACV,WAAK,UAAU;A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;AAAA,IACT;AAAA,IAEA,2BAA2B,OAAO,YAAY;AAC5C,YAAM,eAAe,IAAI,EAAE;AAC3B,UACE,WACA,QAAQ,WACR,gBACA,aAAa,YACb,aAAa,YAAY,QAAQ,WACjC,CAAC,IAAI,EAAE,+BACP;AACA,YAAI,EAAE,+BAA+B,KAAK,CAAC;AAC3C,cAAM,IAAI,EAAE,gBAAgB;AAAA,UAC1B,YAAY,aAAa;AAAA,UACzB,SAAS,QAAQ;AAAA,UACjB,UAAU,aAAa;AAAA,UACvB,mBAAmB,aAAa;AAAA,UAChC,OAAO,aAAa;AAAA,QACtB,CAAC;AACD,YAAI,EAAE,+BAA+B,MAAM,CAAC;AAAA,MAC9C;AAAA,IACF;AAAA,IACA,+BAA+B;AAAA,IAC/B,yBAAyB,OAAO,UAAU;AACxC,YAAM,eAAe,IAAI,EAAE;AAC3B,UACE,UAAU,UACV,gBACA,aAAa,YACb,aAAa,SACb,aAAa,MAAM,OAAO,MAAM,MAChC,CAAC,IAAI,EAAE,6BACP;AACA,YAAI,EAAE,6BAA6B,KAAK,CAAC;AACzC,cAAM,IAAI,EAAE,gBAAgB;AAAA,UAC1B,YAAY,aAAa;AAAA,UACzB,SAAS,aAAa;AAAA,UACtB,UAAU,aAAa;AAAA,UACvB,mBAAmB,aAAa;AAAA,UAChC;AAAA,QACF,CAAC;AACD,YAAI,EAAE,6BAA6B,MAAM,CAAC;AAAA,MAC5C;AAAA,IACF;AAAA,IACA,6BAA6B;AAAA,IAE7B,wBAAwB,CAAC,YAAY;AACnC,UAAI,EAAE,sBAAsB,QAAQ,CAAC;AAAA,IACvC;AAAA,IACA,4BAA4B,MAAM;AAChC,UAAI,EAAE,uBAAuB,GAAG,CAAC;AAAA,IACnC;AAAA,EACF;AACF;","names":["module","EventEmitter","LocalStorageKeys","isEqual","import_chains","import_chains","import_injected","import_chains","EventEmitter","import_viem","import_eventemitter3","EventEmitter","import_viem","_provider","provider","__accessCheck","__privateGet","__privateAdd","__privateSet","__privateMethod","import_viem","import_viem","import_shallow","__privateAdd","status","__privateSet","__privateMethod","__privateGet","status","status","shallow4","shallow5","import_viem","import_chains","normalizeChainId","coinbase","import_react","React","import_immer","import_immer","status","import_immer","dayjs","txPool","import_immer","connector"]} \ No newline at end of file diff --git a/dist/index.d.cts b/dist/index.d.cts index 0b93cbb..86b9a0d 100644 --- a/dist/index.d.cts +++ b/dist/index.d.cts @@ -84,7 +84,7 @@ type IWalletSlice = { activeWallet?: Wallet; setActiveWallet: (wallet: Omit) => Promise; isActiveWalletSetting: boolean; - connectWallet: (walletType: WalletType) => Promise; + connectWallet: (walletType: WalletType, chainId?: number) => Promise; disconnectActiveWallet: () => Promise; walletActivating: boolean; walletConnectionError: string; diff --git a/dist/index.d.ts b/dist/index.d.ts index 0b93cbb..86b9a0d 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -84,7 +84,7 @@ type IWalletSlice = { activeWallet?: Wallet; setActiveWallet: (wallet: Omit) => Promise; isActiveWalletSetting: boolean; - connectWallet: (walletType: WalletType) => Promise; + connectWallet: (walletType: WalletType, chainId?: number) => Promise; disconnectActiveWallet: () => Promise; walletActivating: boolean; walletConnectionError: string; diff --git a/dist/index.js b/dist/index.js index fb53aad..a006a27 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2770,7 +2770,7 @@ function createWalletSlice({ } }, isActiveWalletSetting: false, - connectWallet: async (walletType) => { + connectWallet: async (walletType, chainId) => { clearWalletLinkLocalStorage(); clearWalletConnectV2LocalStorage(); if (get().activeWallet?.walletType !== walletType) { @@ -2785,7 +2785,7 @@ function createWalletSlice({ if (connector) { if (connector instanceof ImpersonatedConnector) { connector.setAccountAddress(get()._impersonatedAddress); - await connect({ connector }); + await connect({ connector, chainId }); } else { await connect({ connector }); } diff --git a/dist/index.js.map b/dist/index.js.map index 24ba4e6..5037b03 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../node_modules/eventemitter3/index.js","../src/hooks/useLastTxLocalStatus.tsx","../src/web3/adapters/GelatoAdapter.ts","../src/utils/localStorage.ts","../src/web3/store/transactionsSelectors.ts","../src/utils/chainInfoHelpers.ts","../src/utils/constants.ts","../src/utils/wallets/wallets/alphawallet.ts","../src/utils/wallets/wallets/atoken.ts","../src/utils/wallets/wallets/binance.ts","../src/utils/wallets/wallets/bitkeep.ts","../src/utils/wallets/wallets/bitpie.ts","../src/utils/wallets/wallets/bitski.ts","../src/utils/wallets/wallets/blockwallet.ts","../src/utils/wallets/wallets/brave.ts","../src/utils/wallets/wallets/coinbase.ts","../src/utils/wallets/wallets/core.ts","../src/utils/wallets/wallets/dcent.ts","../src/utils/wallets/wallets/defiwallet.ts","../src/utils/wallets/wallets/enkrypt.ts","../src/utils/wallets/wallets/exodus.ts","../src/utils/wallets/wallets/frame.ts","../src/utils/wallets/wallets/frontier.ts","../src/utils/wallets/wallets/gamestop.ts","../src/utils/wallets/wallets/huobiwallet.ts","../src/utils/wallets/wallets/hyperpay.ts","../src/utils/wallets/wallets/imtoken.ts","../src/utils/wallets/wallets/liquality.ts","../src/utils/wallets/wallets/mathwallet.ts","../src/utils/wallets/wallets/meetone.ts","../src/utils/wallets/wallets/metamask.ts","../src/utils/wallets/wallets/mykey.ts","../src/utils/wallets/wallets/okxwallet.ts","../src/utils/wallets/wallets/oneInch.ts","../src/utils/wallets/wallets/opera.ts","../src/utils/wallets/wallets/ownbit.ts","../src/utils/wallets/wallets/phantom.ts","../src/utils/wallets/wallets/rabby.ts","../src/utils/wallets/wallets/rainbow.ts","../src/utils/wallets/wallets/safepal.ts","../src/utils/wallets/wallets/sequence.ts","../src/utils/wallets/wallets/status.ts","../src/utils/wallets/wallets/tallywallet.ts","../src/utils/wallets/wallets/tokenary.ts","../src/utils/wallets/wallets/tokenpocket.ts","../src/utils/wallets/wallets/tp.ts","../src/utils/wallets/wallets/trust.ts","../src/utils/wallets/wallets/walletio.ts","../src/utils/wallets/wallets/xdefi.ts","../src/utils/wallets/wallets/zeal.ts","../src/utils/wallets/wallets/zerion.ts","../src/utils/wallets/wallets.ts","../src/utils/wallets/wallets/defaultWallet.ts","../src/utils/wallets/getBrowserWalletLabelAndIcon.ts","../src/web3/connectors/index.ts","../node_modules/@wagmi/connectors/dist/chunk-OQILYQDO.js","../node_modules/@wagmi/connectors/dist/chunk-W65LBPLT.js","../node_modules/@wagmi/connectors/dist/mock/index.js","../node_modules/@wagmi/connectors/dist/chunk-UGBGYVBH.js","../node_modules/@wagmi/connectors/dist/chunk-2UFLHRLT.js","../node_modules/@wagmi/core/dist/chunk-MQXBDTVK.js","../node_modules/@wagmi/core/dist/chunk-TSH6VVF4.js","../src/web3/connectors/ImpersonatedConnector.ts","../src/web3/providers/WagmiProvider.tsx","../src/web3/store/transactionsSlice.ts","../src/web3/adapters/EthereumAdapter.ts","../src/web3/adapters/GnosisAdapter.ts","../src/web3/store/walletSlice.ts"],"sourcesContent":["'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 { useEffect, useState } from 'react';\n\nimport { isGelatoBaseTx } from '../web3/adapters/GelatoAdapter';\nimport { selectLastTxByTypeAndPayload } from '../web3/store/transactionsSelectors';\nimport { BaseTx, ITransactionsState } from '../web3/store/transactionsSlice';\n\ninterface LastTxStatusesParams {\n state: ITransactionsState;\n activeAddress: string;\n type: T['type'];\n payload: T['payload'];\n}\n\ntype ExecuteTxWithLocalStatusesParams = {\n errorMessage: string;\n callbackFunction: () => Promise;\n};\n\nexport const useLastTxLocalStatus = ({\n state,\n activeAddress,\n type,\n payload,\n}: LastTxStatusesParams) => {\n const tx = selectLastTxByTypeAndPayload(state, activeAddress, type, payload);\n\n const [fullTxErrorMessage, setFullTxErrorMessage] = useState(\n '',\n );\n const [error, setError] = useState('');\n const [loading, setLoading] = useState(false);\n const [isTxStart, setIsTxStart] = useState(false);\n\n const txHash = tx && tx.hash;\n const txPending = tx && tx.pending;\n const isError =\n tx && isGelatoBaseTx(tx)\n ? !tx.pending && (tx.status !== 1 || !!error)\n : (tx && !tx.pending && tx.status !== 1) || !!error;\n const txSuccess = tx && tx.status === 1 && !isError;\n const txChainId = tx && tx.chainId;\n const txWalletType = tx && tx.walletType;\n\n useEffect(() => {\n return () => {\n setFullTxErrorMessage('');\n setError('');\n };\n }, []);\n\n useEffect(() => {\n if (txPending || isError) {\n setIsTxStart(true);\n }\n }, [txPending, isError]);\n\n useEffect(() => {\n if (tx?.errorMessage) {\n setError(tx.errorMessage);\n }\n }, [tx?.errorMessage]);\n\n async function executeTxWithLocalStatuses({\n errorMessage,\n callbackFunction,\n }: ExecuteTxWithLocalStatusesParams) {\n setError('');\n setLoading(true);\n try {\n await callbackFunction();\n } catch (e) {\n if (e instanceof Error) {\n console.error('TX error: ', e);\n setFullTxErrorMessage(!!e?.message ? e.message : e);\n setError(errorMessage);\n }\n }\n setLoading(false);\n }\n\n return {\n error,\n setError,\n loading,\n setLoading,\n isTxStart,\n setIsTxStart,\n txHash,\n txPending,\n txSuccess,\n txChainId,\n txWalletType,\n isError,\n executeTxWithLocalStatuses,\n fullTxErrorMessage,\n setFullTxErrorMessage,\n };\n};\n","import { produce } from 'immer';\nimport { Hex } from 'viem';\n\nimport { setLocalStorageTxPool } from '../../utils/localStorage';\nimport { selectIsGelatoTXPending } from '../store/transactionsSelectors';\nimport {\n BaseTx,\n GelatoBaseTx,\n InitialTx,\n ITransactionsSlice,\n NewTx,\n} from '../store/transactionsSlice';\nimport { Wallet } from '../store/walletSlice';\nimport { AdapterInterface } from './interface';\n\nexport type GelatoTXState =\n | 'WaitingForConfirmation'\n | 'CheckPending'\n | 'ExecSuccess'\n | 'Cancelled'\n | 'ExecPending'\n | 'ExecReverted';\n\nexport type GelatoTaskStatusResponse = {\n task: {\n chainId: number;\n taskId: string;\n taskState: GelatoTXState;\n creationDate?: string;\n executionDate?: string;\n transactionHash?: Hex;\n blockNumber?: number;\n lastCheckMessage?: string;\n };\n};\n\nexport type GelatoTx = {\n taskId: string;\n};\n\nexport function isGelatoTx(tx: InitialTx): tx is GelatoTx {\n return (tx as GelatoTx).taskId !== undefined;\n}\n\nexport function isGelatoBaseTx(tx: BaseTx): tx is GelatoBaseTx {\n return (tx as GelatoBaseTx).taskId !== undefined;\n}\n\nexport function isGelatoBaseTxWithoutTimestamp(\n tx: Omit,\n): tx is Omit {\n return (tx as GelatoBaseTx).taskId !== undefined;\n}\n\nexport class GelatoAdapter implements AdapterInterface {\n get: () => ITransactionsSlice;\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void;\n transactionsIntervalsMap: Record = {};\n\n constructor(\n get: () => ITransactionsSlice,\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void,\n ) {\n this.get = get;\n this.set = set;\n }\n\n executeTx = async (params: {\n tx: NewTx;\n activeWallet: Wallet;\n payload: object | undefined;\n chainId: number;\n type: T['type'];\n }): Promise => {\n const { activeWallet, chainId, type } = params;\n const tx = params.tx as GelatoTx;\n const from = activeWallet.address;\n const gelatoTX = {\n from: from as Hex,\n chainId,\n type: type,\n taskId: tx.taskId,\n payload: params.payload,\n };\n\n const txPool = this.get().addTXToPool(gelatoTX, activeWallet.walletType);\n this.startTxTracking(tx.taskId);\n\n return txPool[tx.taskId];\n };\n\n startTxTracking = async (taskId: string) => {\n const tx = this.get().transactionsPool[taskId] as GelatoBaseTx;\n\n const isPending = selectIsGelatoTXPending(tx.gelatoStatus);\n if (!isPending) {\n return;\n }\n\n this.stopPollingGelatoTXStatus(taskId);\n\n const newGelatoInterval = setInterval(() => {\n this.fetchGelatoTXStatus(taskId);\n // TODO: maybe change timeout for gelato\n }, 2000);\n\n this.transactionsIntervalsMap[taskId] = Number(newGelatoInterval);\n };\n\n private stopPollingGelatoTXStatus = (taskId: string) => {\n const currentInterval = this.transactionsIntervalsMap[taskId];\n clearInterval(currentInterval);\n this.transactionsIntervalsMap[taskId] = undefined;\n };\n\n private fetchGelatoTXStatus = async (taskId: string) => {\n const response = await fetch(\n `https://api.gelato.digital/tasks/status/${taskId}/`,\n );\n if (!response.ok) {\n // TODO: handle error if needed, for now just skipping\n } else {\n const gelatoStatus = (await response.json()) as GelatoTaskStatusResponse;\n\n const isPending = selectIsGelatoTXPending(gelatoStatus.task.taskState);\n this.updateGelatoTX(taskId, gelatoStatus);\n if (!isPending) {\n this.stopPollingGelatoTXStatus(taskId);\n const tx = this.get().transactionsPool[taskId];\n this.get().txStatusChangedCallback(tx);\n }\n }\n };\n\n private updateGelatoTX = (\n taskId: string,\n statusResponse: GelatoTaskStatusResponse,\n ) => {\n this.set((state) =>\n produce(state, (draft) => {\n const tx = draft.transactionsPool[taskId] as GelatoBaseTx & {\n pending: boolean;\n status?: number;\n };\n tx.gelatoStatus = statusResponse.task.taskState;\n tx.pending = selectIsGelatoTXPending(statusResponse.task.taskState);\n tx.hash = statusResponse.task.transactionHash;\n tx.status =\n statusResponse.task.taskState === 'ExecSuccess'\n ? 1\n : tx.pending\n ? undefined\n : 0;\n if (statusResponse.task.executionDate) {\n tx.timestamp = new Date(statusResponse.task.executionDate).getTime();\n }\n if (statusResponse.task.lastCheckMessage) {\n tx.errorMessage = statusResponse.task.lastCheckMessage;\n }\n }),\n );\n setLocalStorageTxPool(this.get().transactionsPool);\n };\n}\n","import { WalletType } from '../web3/connectors';\nimport { BaseTx, TransactionPool } from '../web3/store/transactionsSlice';\n\nexport enum LocalStorageKeys {\n LastConnectedWallet = 'LastConnectedWallet',\n TransactionPool = 'TransactionPool',\n}\n\nexport const setLocalStorageTxPool = (\n pool: TransactionPool,\n) => {\n const stringifiedPool = JSON.stringify(pool);\n localStorage.setItem(LocalStorageKeys.TransactionPool, stringifiedPool);\n};\n\nexport const getLocalStorageTxPool = () => {\n return localStorage.getItem(LocalStorageKeys.TransactionPool);\n};\n\nexport const setLocalStorageWallet = (walletType: WalletType) => {\n localStorage.setItem(LocalStorageKeys.LastConnectedWallet, walletType);\n};\n\nexport const deleteLocalStorageWallet = () => {\n localStorage.removeItem(LocalStorageKeys.LastConnectedWallet);\n localStorage.removeItem('wagmi.wallet');\n};\n\nexport const clearWalletLinkLocalStorage = () => {\n localStorage.removeItem('walletconnect');\n localStorage.removeItem('-walletlink:https://www.walletlink.org:version');\n localStorage.removeItem('-walletlink:https://www.walletlink.org:session:id');\n localStorage.removeItem(\n '-walletlink:https://www.walletlink.org:session:secret',\n );\n localStorage.removeItem(\n '-walletlink:https://www.walletlink.org:session:linked',\n );\n localStorage.removeItem('-walletlink:https://www.walletlink.org:AppVersion');\n localStorage.removeItem('-walletlink:https://www.walletlink.org:Addresses');\n localStorage.removeItem(\n '-walletlink:https://www.walletlink.org:walletUsername',\n );\n};\n\nexport const clearWalletConnectV2LocalStorage = () => {\n localStorage.removeItem('wc@2:core:0.3//messages');\n localStorage.removeItem('wc@2:client:0.3//proposal');\n localStorage.removeItem('wc@2:universal_provider:/namespaces');\n localStorage.removeItem('wc@2:core:0.3//subscription');\n localStorage.removeItem('wc@2:core:0.3//history');\n localStorage.removeItem('wc@2:core:0.3//expirer');\n localStorage.removeItem('wc@2:core:0.3//pairing');\n localStorage.removeItem('wc@2:universal_provider:/optionalNamespaces');\n};\n","import isEqual from 'lodash/isEqual.js';\nimport { Chain } from 'viem';\nimport { goerli, mainnet } from 'viem/chains';\n\nimport { isGelatoBaseTx } from '../adapters/GelatoAdapter';\nimport { BaseTx, GelatoBaseTx, ITransactionsState } from './transactionsSlice';\n\nexport const selectAllTransactions = (\n state: ITransactionsState,\n) => {\n return Object.values(state.transactionsPool).sort(\n (a, b) => Number(a.localTimestamp) - Number(b.localTimestamp),\n );\n};\n\nexport const selectPendingTransactions = (\n state: ITransactionsState,\n) => {\n return selectAllTransactions(state).filter((tx) => tx.pending);\n};\n\nexport const selectTXByKey = (\n state: ITransactionsState,\n key: string,\n) => {\n return state.transactionsPool[key];\n};\n\nexport const selectTXByHash = (\n state: ITransactionsState,\n hash: string,\n) => {\n const txByKey = selectTXByKey(state, hash);\n if (txByKey) {\n return txByKey;\n }\n return selectAllTransactions(state).find((tx) => tx.hash === hash);\n};\n\nexport const selectAllTransactionsByWallet = (\n state: ITransactionsState,\n from: string,\n) => {\n return selectAllTransactions(state).filter((tx) => tx.from === from);\n};\n\nexport const selectPendingTransactionByWallet = (\n state: ITransactionsState,\n from: string,\n) => {\n return selectPendingTransactions(state).filter((tx) => tx.from === from);\n};\n\nexport const selectLastTxByTypeAndPayload = (\n state: ITransactionsState,\n from: string,\n type: T['type'],\n payload: T['payload'],\n) => {\n const allTransactions = selectAllTransactionsByWallet(state, from);\n const filteredTransactions = allTransactions.filter(\n (tx) => tx.type === type && isEqual(tx.payload, payload),\n );\n const lastFilteredTransaction =\n filteredTransactions[filteredTransactions.length - 1];\n\n if (lastFilteredTransaction) {\n if (isGelatoBaseTx(lastFilteredTransaction)) {\n return selectTXByKey(state, lastFilteredTransaction.taskId);\n } else {\n if (lastFilteredTransaction.hash) {\n return selectTXByKey(state, lastFilteredTransaction.hash);\n } else {\n return undefined;\n }\n }\n } else {\n return undefined;\n }\n};\n\nexport const selectTxExplorerLink = (\n state: ITransactionsState,\n getChainParameters: (chainId: number) => Chain,\n txHash: string,\n) => {\n const tx = selectTXByHash(state, txHash);\n if (!tx) {\n return '';\n }\n\n // TODO: need check\n const gnosisSafeLinksHelper: Record = {\n [mainnet.id]: 'https://app.safe.global/eth:',\n [goerli.id]: 'https://app.safe.global/gor:',\n };\n\n if (tx.walletType !== 'GnosisSafe') {\n return `${getChainParameters(tx.chainId).blockExplorers}/tx/${txHash}`;\n } else {\n return `${gnosisSafeLinksHelper[tx.chainId]}${\n tx.from\n }/transactions/tx?id=multisig_${tx.from}_${txHash}`;\n }\n};\n\nexport const selectIsGelatoTXPending = (\n gelatoStatus?: GelatoBaseTx['gelatoStatus'],\n) => {\n return (\n gelatoStatus === undefined ||\n gelatoStatus === 'CheckPending' ||\n gelatoStatus === 'WaitingForConfirmation' ||\n gelatoStatus === 'ExecPending'\n );\n};\n","import { Chain, createPublicClient, http, PublicClient } from 'viem';\nimport {\n avalanche,\n avalancheFuji,\n goerli,\n mainnet,\n polygon,\n polygonMumbai,\n sepolia,\n} from 'viem/chains';\n\nexport const initialChains: Record = {\n [mainnet.id]: mainnet,\n [polygon.id]: polygon,\n [polygonMumbai.id]: polygonMumbai,\n [avalanche.id]: avalanche,\n [avalancheFuji.id]: avalancheFuji,\n [goerli.id]: goerli,\n [sepolia.id]: sepolia,\n};\n\nexport const initChainInformationConfig = (chains?: Record) => {\n const CHAINS = { ...initialChains, ...chains } || {};\n\n // init clients instances from chain config\n const initalizedClients: Record = {};\n const clientInstances = Object.values(CHAINS).reduce<{\n [chainId: number]: {\n instance: PublicClient;\n };\n }>((accumulator, chain) => {\n const numberChainId = Number(chain.id);\n accumulator[numberChainId] = {\n get instance() {\n if (initalizedClients[numberChainId]) {\n return initalizedClients[numberChainId];\n } else {\n const client = createPublicClient({\n batch: {\n multicall: true,\n },\n chain,\n transport: http(),\n }) as PublicClient;\n initalizedClients[numberChainId] = client;\n return client;\n }\n },\n } as {\n instance: PublicClient;\n };\n return accumulator;\n }, {});\n\n function getChainParameters(chainId: number): Chain {\n const chainInformation = CHAINS[chainId];\n if (chainInformation) {\n return chainInformation;\n } else {\n // this case can only ever occure when a wallet is connected with an unknown chainId which will not allow interaction\n return {\n ...mainnet,\n id: chainId,\n name: `unknown network: ${chainId}`,\n };\n }\n }\n\n return {\n clientInstances,\n getChainParameters,\n };\n};\n","import {\n arbitrum,\n avalanche,\n goerli,\n mainnet,\n optimism,\n polygon,\n} from 'viem/chains';\n\nexport const SafeTransactionServiceUrls: { [key in number]: string } = {\n [mainnet.id]: 'https://safe-transaction-mainnet.safe.global/api/v1',\n [goerli.id]: 'https://safe-transaction-goerli.safe.global/api/v1',\n [optimism.id]: 'https://safe-transaction-optimism.safe.global/api/v1',\n [polygon.id]: 'https://safe-transaction-polygon.safe.global/api/v1',\n [arbitrum.id]: 'https://safe-transaction-arbitrum.safe.global/api/v1',\n [avalanche.id]: 'https://safe-transaction-avalanche.safe.global/api/v1',\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const alphawallet = {\n identityFlag: WalletIdentityFlag.AlphaWallet,\n label: WalletLabel.AlphaWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const atoken = {\n identityFlag: WalletIdentityFlag.AToken,\n label: WalletLabel.AToken,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const binance = {\n identityFlag: WalletIdentityFlag.Binance,\n label: WalletLabel.Binance,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const bitkeep = {\n identityFlag: WalletIdentityFlag.BitKeep,\n label: WalletLabel.BitKeep,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const bitpie = {\n identityFlag: WalletIdentityFlag.Bitpie,\n label: WalletLabel.Bitpie,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const bitski = {\n identityFlag: WalletIdentityFlag.Bitski,\n label: WalletLabel.Bitski,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const blockwallet = {\n identityFlag: WalletIdentityFlag.BlockWallet,\n label: WalletLabel.BlockWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const brave = {\n identityFlag: WalletIdentityFlag.BraveWallet,\n label: WalletLabel.Brave,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const coinbase = {\n identityFlag: WalletIdentityFlag.Coinbase,\n label: WalletLabel.Coinbase,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const core = {\n identityFlag: WalletIdentityFlag.Core,\n label: WalletLabel.Core,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const dcent = {\n identityFlag: WalletIdentityFlag.Dcent,\n label: WalletLabel.Dcent,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const defiwallet = {\n identityFlag: WalletIdentityFlag.DeFiWallet,\n label: WalletLabel.DeFiWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const enkrypt = {\n identityFlag: WalletIdentityFlag.Enkrypt,\n label: WalletLabel.Enkrypt,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const exodus = {\n identityFlag: WalletIdentityFlag.Exodus,\n label: WalletLabel.Exodus,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const frame = {\n identityFlag: WalletIdentityFlag.Frame,\n label: WalletLabel.Frame,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const frontier = {\n identityFlag: WalletIdentityFlag.Frontier,\n label: WalletLabel.Frontier,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const gamestop = {\n identityFlag: WalletIdentityFlag.GameStop,\n label: WalletLabel.GameStop,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const huobiwallet = {\n identityFlag: WalletIdentityFlag.HuobiWallet,\n label: WalletLabel.HuobiWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const hyperpay = {\n identityFlag: WalletIdentityFlag.HyperPay,\n label: WalletLabel.HyperPay,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const imtoken = {\n identityFlag: WalletIdentityFlag.ImToken,\n label: WalletLabel.ImToken,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const liquality = {\n identityFlag: WalletIdentityFlag.Liquality,\n label: WalletLabel.Liquality,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const mathwallet = {\n identityFlag: WalletIdentityFlag.MathWallet,\n label: WalletLabel.MathWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const meetone = {\n identityFlag: WalletIdentityFlag.MeetOne,\n label: WalletLabel.MeetOne,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const metamask = {\n identityFlag: WalletIdentityFlag.MetaMask,\n label: WalletLabel.MetaMask,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const mykey = {\n identityFlag: WalletIdentityFlag.MyKey,\n label: WalletLabel.MyKey,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const okxwallet = {\n identityFlag: WalletIdentityFlag.OKXWallet,\n label: WalletLabel.OKXWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const oneInch = {\n identityFlag: WalletIdentityFlag.OneInch,\n label: WalletLabel.OneInch,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const opera = {\n identityFlag: WalletIdentityFlag.Opera,\n label: WalletLabel.Opera,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const ownbit = {\n identityFlag: WalletIdentityFlag.OwnBit,\n label: WalletLabel.OwnBit,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const phantom = {\n identityFlag: WalletIdentityFlag.Phantom,\n label: WalletLabel.Phantom,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const rabby = {\n identityFlag: WalletIdentityFlag.Rabby,\n label: WalletLabel.Rabby,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const rainbow = {\n identityFlag: WalletIdentityFlag.Rainbow,\n label: WalletLabel.Rainbow,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const safepal = {\n identityFlag: WalletIdentityFlag.SafePal,\n label: WalletLabel.SafePal,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const sequence = {\n identityFlag: WalletIdentityFlag.Sequence,\n label: WalletLabel.Sequence,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const status = {\n identityFlag: WalletIdentityFlag.Status,\n label: WalletLabel.Status,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tallywallet = {\n identityFlag: WalletIdentityFlag.Tally,\n label: WalletLabel.Tally,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tokenary = {\n identityFlag: WalletIdentityFlag.Tokenary,\n label: WalletLabel.Tokenary,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tokenpocket = {\n identityFlag: WalletIdentityFlag.TokenPocket,\n label: WalletLabel.TokenPocket,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tp = {\n identityFlag: WalletIdentityFlag.TP,\n label: WalletLabel.TP,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const trust = {\n identityFlag: WalletIdentityFlag.Trust,\n label: WalletLabel.Trust,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const walletio = {\n identityFlag: WalletIdentityFlag.WalletIo,\n label: WalletLabel.WalletIo,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const xdefi = {\n identityFlag: WalletIdentityFlag.XDEFI,\n label: WalletLabel.XDEFI,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const zeal = {\n identityFlag: WalletIdentityFlag.Zeal,\n label: WalletLabel.Zeal,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const zerion = {\n identityFlag: WalletIdentityFlag.Zerion,\n label: WalletLabel.Zerion,\n icon: ``,\n};\n","import { alphawallet } from './wallets/alphawallet';\nimport { atoken } from './wallets/atoken';\nimport { binance } from './wallets/binance';\nimport { bitkeep } from './wallets/bitkeep';\nimport { bitpie } from './wallets/bitpie';\nimport { bitski } from './wallets/bitski';\nimport { blockwallet } from './wallets/blockwallet';\nimport { brave } from './wallets/brave';\nimport { coinbase } from './wallets/coinbase';\nimport { core } from './wallets/core';\nimport { dcent } from './wallets/dcent';\nimport { defiwallet } from './wallets/defiwallet';\nimport { enkrypt } from './wallets/enkrypt';\nimport { exodus } from './wallets/exodus';\nimport { frame } from './wallets/frame';\nimport { frontier } from './wallets/frontier';\nimport { gamestop } from './wallets/gamestop';\nimport { huobiwallet } from './wallets/huobiwallet';\nimport { hyperpay } from './wallets/hyperpay';\nimport { imtoken } from './wallets/imtoken';\nimport { liquality } from './wallets/liquality';\nimport { mathwallet } from './wallets/mathwallet';\nimport { meetone } from './wallets/meetone';\nimport { metamask } from './wallets/metamask';\nimport { mykey } from './wallets/mykey';\nimport { okxwallet } from './wallets/okxwallet';\nimport { oneInch } from './wallets/oneInch';\nimport { opera } from './wallets/opera';\nimport { ownbit } from './wallets/ownbit';\nimport { phantom } from './wallets/phantom';\nimport { rabby } from './wallets/rabby';\nimport { rainbow } from './wallets/rainbow';\nimport { safepal } from './wallets/safepal';\nimport { sequence } from './wallets/sequence';\nimport { status } from './wallets/status';\nimport { tallywallet } from './wallets/tallywallet';\nimport { tokenary } from './wallets/tokenary';\nimport { tokenpocket } from './wallets/tokenpocket';\nimport { tp } from './wallets/tp';\nimport { trust } from './wallets/trust';\nimport { walletio } from './wallets/walletio';\nimport { xdefi } from './wallets/xdefi';\nimport { zeal } from './wallets/zeal';\nimport { zerion } from './wallets/zerion';\n\nexport const wallets = [\n alphawallet,\n atoken,\n binance,\n bitkeep,\n bitpie,\n bitski,\n blockwallet,\n brave,\n coinbase,\n core,\n dcent,\n defiwallet,\n enkrypt,\n exodus,\n frame,\n frontier,\n gamestop,\n huobiwallet,\n hyperpay,\n imtoken,\n liquality,\n mathwallet,\n meetone,\n metamask,\n mykey,\n okxwallet,\n oneInch,\n opera,\n ownbit,\n phantom,\n rabby,\n rainbow,\n safepal,\n sequence,\n status,\n tallywallet,\n tokenary,\n tokenpocket,\n tp,\n trust,\n walletio,\n xdefi,\n zeal,\n zerion,\n];\n","export const defaultWallet = {\n label: 'Browser wallet',\n icon: ``,\n};\n","import { wallets } from './wallets';\nimport { defaultWallet } from './wallets/defaultWallet';\n\nexport function getBrowserWalletLabelAndIcon() {\n const defaultBrowserWallet = {\n label: defaultWallet.label,\n icon: defaultWallet.icon,\n };\n\n if (typeof window !== 'undefined') {\n if (!!window.ethereum) {\n const userBrowserWallets = wallets.filter(\n (wallet) => !!window.ethereum[wallet.identityFlag],\n );\n if (userBrowserWallets.length > 1 || userBrowserWallets.length === 0) {\n return defaultBrowserWallet;\n } else {\n return {\n label: userBrowserWallets[0].label,\n icon: userBrowserWallets[0].icon,\n };\n }\n } else {\n return defaultBrowserWallet;\n }\n } else {\n return defaultBrowserWallet;\n }\n}\n","import { Chain } from 'viem';\nimport { CoinbaseWalletConnector } from 'wagmi/connectors/coinbaseWallet';\nimport { InjectedConnector } from 'wagmi/connectors/injected';\nimport { SafeConnector } from 'wagmi/connectors/safe';\nimport { WalletConnectConnector } from 'wagmi/connectors/walletConnect';\n\nimport { ImpersonatedConnector } from './ImpersonatedConnector';\n\nexport type ConnectorType =\n | InjectedConnector\n | WalletConnectConnector\n | CoinbaseWalletConnector\n | SafeConnector\n | ImpersonatedConnector;\n\nexport type AllConnectorsInitProps = {\n appName: string;\n chains: Record;\n defaultChainId?: number;\n wcParams?: {\n projectId: string;\n metadata: {\n name: string;\n description: string;\n url: string;\n icons: string[];\n };\n };\n};\n\nexport const initAllConnectors = (props: AllConnectorsInitProps) => {\n const chains = Object.values(props.chains);\n const chainIds = Object.keys(props.chains).map(Number);\n\n const wcParams = props.wcParams;\n let walletConnect: WalletConnectConnector | null = null;\n if (wcParams) {\n walletConnect = new WalletConnectConnector({\n chains,\n options: {\n ...wcParams,\n },\n });\n }\n\n const injected = new InjectedConnector({\n chains,\n options: {\n name: (detectedName) =>\n `${\n typeof detectedName === 'string'\n ? detectedName\n : detectedName.join(', ')\n }`,\n },\n });\n const coinbase = new CoinbaseWalletConnector({\n chains,\n options: {\n appName: props.appName,\n jsonRpcUrl:\n props.chains[props.defaultChainId || chainIds[0]].rpcUrls.default\n .http[0],\n },\n });\n const gnosisSafe = new SafeConnector({\n chains,\n options: {\n allowedDomains: [/gnosis-safe.io$/, /app.safe.global$/],\n debug: false,\n },\n });\n\n const impersonated = new ImpersonatedConnector({\n chains,\n options: {\n chainId: props.chains[props.defaultChainId || chainIds[0]].id,\n },\n });\n\n const connectors: ConnectorType[] = [\n injected,\n coinbase,\n gnosisSafe,\n impersonated,\n ];\n if (walletConnect !== null) {\n connectors.push(walletConnect);\n }\n\n return connectors;\n};\n\nexport type WalletType =\n | 'Injected'\n | 'WalletConnect'\n | 'Coinbase'\n | 'GnosisSafe'\n | 'Impersonated';\n\nexport function getConnectorName(\n connector: ConnectorType,\n): WalletType | undefined {\n if (connector instanceof InjectedConnector) return 'Injected';\n if (connector instanceof WalletConnectConnector) return 'WalletConnect';\n if (connector instanceof CoinbaseWalletConnector) return 'Coinbase';\n if (connector instanceof SafeConnector) return 'GnosisSafe';\n if (connector instanceof ImpersonatedConnector) return 'Impersonated';\n return;\n}\n","// src/utils/normalizeChainId.ts\nfunction normalizeChainId(chainId) {\n if (typeof chainId === \"string\")\n return Number.parseInt(\n chainId,\n chainId.trim().substring(0, 2) === \"0x\" ? 16 : 10\n );\n if (typeof chainId === \"bigint\")\n return Number(chainId);\n return chainId;\n}\n\nexport {\n normalizeChainId\n};\n","var __accessCheck = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n};\nvar __privateGet = (obj, member, getter) => {\n __accessCheck(obj, member, \"read from private field\");\n return getter ? getter.call(obj) : member.get(obj);\n};\nvar __privateAdd = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n};\nvar __privateSet = (obj, member, value, setter) => {\n __accessCheck(obj, member, \"write to private field\");\n setter ? setter.call(obj, value) : member.set(obj, value);\n return value;\n};\nvar __privateMethod = (obj, member, method) => {\n __accessCheck(obj, member, \"access private method\");\n return method;\n};\n\n// src/base.ts\nimport { default as EventEmitter } from \"eventemitter3\";\nimport { goerli, mainnet } from \"viem/chains\";\nvar Connector = class extends EventEmitter {\n constructor({\n chains = [mainnet, goerli],\n options\n }) {\n super();\n this.chains = chains;\n this.options = options;\n }\n getBlockExplorerUrls(chain) {\n const { default: blockExplorer, ...blockExplorers } = chain.blockExplorers ?? {};\n if (blockExplorer)\n return [\n blockExplorer.url,\n ...Object.values(blockExplorers).map((x) => x.url)\n ];\n }\n isChainUnsupported(chainId) {\n return !this.chains.some((x) => x.id === chainId);\n }\n setStorage(storage) {\n this.storage = storage;\n }\n};\n\nexport {\n __privateGet,\n __privateAdd,\n __privateSet,\n __privateMethod,\n Connector\n};\n","import {\n normalizeChainId\n} from \"../chunk-OQILYQDO.js\";\nimport {\n Connector,\n __privateAdd,\n __privateGet,\n __privateMethod,\n __privateSet\n} from \"../chunk-W65LBPLT.js\";\n\n// src/mock/connector.ts\nimport { getAddress as getAddress2 } from \"viem\";\n\n// src/mock/provider.ts\nimport { default as EventEmitter } from \"eventemitter3\";\nimport { UserRejectedRequestError, getAddress } from \"viem\";\nvar _options, _walletClient;\nvar MockProvider = class {\n constructor(options) {\n this.events = new EventEmitter();\n __privateAdd(this, _options, void 0);\n __privateAdd(this, _walletClient, void 0);\n this.chainId = options.chainId;\n __privateSet(this, _options, options);\n }\n async enable() {\n if (__privateGet(this, _options).flags?.failConnect)\n throw new UserRejectedRequestError(new Error(\"Failed to connect.\"));\n if (!__privateGet(this, _walletClient))\n __privateSet(this, _walletClient, __privateGet(this, _options).walletClient);\n const address = __privateGet(this, _walletClient).account.address;\n this.events.emit(\"accountsChanged\", [address]);\n return [address];\n }\n async disconnect() {\n this.events.emit(\"disconnect\");\n __privateSet(this, _walletClient, void 0);\n }\n async getAccounts() {\n const address = __privateGet(this, _walletClient)?.account.address;\n if (!address)\n return [];\n return [getAddress(address)];\n }\n getWalletClient() {\n const walletClient = __privateGet(this, _walletClient);\n if (!walletClient)\n throw new Error(\"walletClient not found\");\n return walletClient;\n }\n async switchChain(chainId) {\n if (__privateGet(this, _options).flags?.failSwitchChain)\n throw new UserRejectedRequestError(new Error(\"Failed to switch chain.\"));\n __privateGet(this, _options).chainId = chainId;\n this.chainId = chainId;\n this.events.emit(\"chainChanged\", chainId);\n }\n async switchWalletClient(walletClient) {\n const address = walletClient.account.address;\n __privateSet(this, _walletClient, walletClient);\n this.events.emit(\"accountsChanged\", [address]);\n }\n async watchAsset(_asset) {\n return true;\n }\n async request({ method, params }) {\n return __privateGet(this, _walletClient)?.transport.request({ method, params });\n }\n on(event, listener) {\n this.events.on(event, listener);\n return this;\n }\n removeListener(event, listener) {\n this.events.removeListener(event, listener);\n return this;\n }\n toJSON() {\n return \"\";\n }\n};\n_options = new WeakMap();\n_walletClient = new WeakMap();\n\n// src/mock/connector.ts\nvar _provider, _switchChain, switchChain_fn;\nvar MockConnector = class extends Connector {\n constructor({\n chains,\n options\n }) {\n super({\n chains,\n options: {\n ...options,\n chainId: options.chainId ?? chains?.[0]?.id\n }\n });\n __privateAdd(this, _switchChain);\n this.id = \"mock\";\n this.name = \"Mock\";\n this.ready = true;\n __privateAdd(this, _provider, void 0);\n this.onAccountsChanged = (accounts) => {\n if (accounts.length === 0)\n this.emit(\"disconnect\");\n else\n this.emit(\"change\", { account: getAddress2(accounts[0]) });\n };\n this.onChainChanged = (chainId) => {\n const id = normalizeChainId(chainId);\n const unsupported = this.isChainUnsupported(id);\n this.emit(\"change\", { chain: { id, unsupported } });\n };\n this.onDisconnect = () => {\n this.emit(\"disconnect\");\n };\n }\n async connect({ chainId } = {}) {\n const provider = await this.getProvider({ chainId });\n provider.on(\"accountsChanged\", this.onAccountsChanged);\n provider.on(\"chainChanged\", this.onChainChanged);\n provider.on(\"disconnect\", this.onDisconnect);\n this.emit(\"message\", { type: \"connecting\" });\n const accounts = await provider.enable();\n const account = getAddress2(accounts[0]);\n const id = normalizeChainId(provider.chainId);\n const unsupported = this.isChainUnsupported(id);\n const data = { account, chain: { id, unsupported }, provider };\n if (!this.options.flags?.noSwitchChain)\n this.switchChain = __privateMethod(this, _switchChain, switchChain_fn);\n return new Promise(\n (res) => setTimeout(() => res(data), 100)\n );\n }\n async disconnect() {\n const provider = await this.getProvider();\n await provider.disconnect();\n provider.removeListener(\"accountsChanged\", this.onAccountsChanged);\n provider.removeListener(\"chainChanged\", this.onChainChanged);\n provider.removeListener(\"disconnect\", this.onDisconnect);\n }\n async getAccount() {\n const provider = await this.getProvider();\n const accounts = await provider.getAccounts();\n const account = accounts[0];\n if (!account)\n throw new Error(\"Failed to get account\");\n return getAddress2(account);\n }\n async getChainId() {\n const provider = await this.getProvider();\n return normalizeChainId(provider.chainId);\n }\n async getProvider({ chainId } = {}) {\n if (!__privateGet(this, _provider) || chainId)\n __privateSet(this, _provider, new MockProvider({\n ...this.options,\n chainId: chainId ?? this.options.chainId ?? this.chains[0].id\n }));\n return __privateGet(this, _provider);\n }\n async getWalletClient() {\n const provider = await this.getProvider();\n return provider.getWalletClient();\n }\n async isAuthorized() {\n try {\n const provider = await this.getProvider();\n const account = await provider.getAccounts();\n return this.options.flags?.isAuthorized ?? !!account;\n } catch {\n return false;\n }\n }\n async watchAsset(asset) {\n const provider = await this.getProvider();\n return provider.watchAsset(asset);\n }\n toJSON() {\n return \"\";\n }\n};\n_provider = new WeakMap();\n_switchChain = new WeakSet();\nswitchChain_fn = async function(chainId) {\n const provider = await this.getProvider();\n await provider.switchChain(chainId);\n return this.chains.find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${chainId}`,\n network: `${chainId}`,\n nativeCurrency: { name: \"Ether\", decimals: 18, symbol: \"ETH\" },\n rpcUrls: { default: { http: [\"\"] }, public: { http: [\"\"] } }\n };\n};\nexport {\n MockConnector,\n MockProvider\n};\n","// src/errors.ts\nvar ChainNotConfiguredForConnectorError = class extends Error {\n constructor({\n chainId,\n connectorId\n }) {\n super(`Chain \"${chainId}\" not configured for connector \"${connectorId}\".`);\n this.name = \"ChainNotConfiguredForConnectorError\";\n }\n};\nvar ConnectorNotFoundError = class extends Error {\n constructor() {\n super(...arguments);\n this.name = \"ConnectorNotFoundError\";\n this.message = \"Connector not found\";\n }\n};\n\nexport {\n ChainNotConfiguredForConnectorError,\n ConnectorNotFoundError\n};\n","import {\n ChainNotConfiguredForConnectorError,\n ConnectorNotFoundError\n} from \"./chunk-UGBGYVBH.js\";\nimport {\n normalizeChainId\n} from \"./chunk-OQILYQDO.js\";\nimport {\n Connector,\n __privateAdd,\n __privateGet,\n __privateSet\n} from \"./chunk-W65LBPLT.js\";\n\n// src/injected.ts\nimport {\n ResourceUnavailableRpcError,\n SwitchChainError,\n UserRejectedRequestError,\n createWalletClient,\n custom,\n getAddress,\n numberToHex\n} from \"viem\";\n\n// src/utils/getInjectedName.ts\nfunction getInjectedName(ethereum) {\n if (!ethereum)\n return \"Injected\";\n const getName = (provider) => {\n if (provider.isApexWallet)\n return \"Apex Wallet\";\n if (provider.isAvalanche)\n return \"Core Wallet\";\n if (provider.isBackpack)\n return \"Backpack\";\n if (provider.isBifrost)\n return \"Bifrost Wallet\";\n if (provider.isBitKeep)\n return \"BitKeep\";\n if (provider.isBitski)\n return \"Bitski\";\n if (provider.isBlockWallet)\n return \"BlockWallet\";\n if (provider.isBraveWallet)\n return \"Brave Wallet\";\n if (provider.isCoin98)\n return \"Coin98 Wallet\";\n if (provider.isCoinbaseWallet)\n return \"Coinbase Wallet\";\n if (provider.isDawn)\n return \"Dawn Wallet\";\n if (provider.isDefiant)\n return \"Defiant\";\n if (provider.isDesig)\n return \"Desig Wallet\";\n if (provider.isEnkrypt)\n return \"Enkrypt\";\n if (provider.isExodus)\n return \"Exodus\";\n if (provider.isFordefi)\n return \"Fordefi\";\n if (provider.isFrame)\n return \"Frame\";\n if (provider.isFrontier)\n return \"Frontier Wallet\";\n if (provider.isGamestop)\n return \"GameStop Wallet\";\n if (provider.isHaqqWallet)\n return \"HAQQ Wallet\";\n if (provider.isHyperPay)\n return \"HyperPay Wallet\";\n if (provider.isImToken)\n return \"ImToken\";\n if (provider.isHaloWallet)\n return \"Halo Wallet\";\n if (provider.isKuCoinWallet)\n return \"KuCoin Wallet\";\n if (provider.isMathWallet)\n return \"MathWallet\";\n if (provider.isNovaWallet)\n return \"Nova Wallet\";\n if (provider.isOkxWallet || provider.isOKExWallet)\n return \"OKX Wallet\";\n if (provider.isOneInchIOSWallet || provider.isOneInchAndroidWallet)\n return \"1inch Wallet\";\n if (provider.isOpera)\n return \"Opera\";\n if (provider.isPhantom)\n return \"Phantom\";\n if (provider.isPortal)\n return \"Ripio Portal\";\n if (provider.isRabby)\n return \"Rabby Wallet\";\n if (provider.isRainbow)\n return \"Rainbow\";\n if (provider.isStatus)\n return \"Status\";\n if (provider.isSubWallet)\n return \"SubWallet\";\n if (provider.isTalisman)\n return \"Talisman\";\n if (provider.isTally)\n return \"Taho\";\n if (provider.isTokenPocket)\n return \"TokenPocket\";\n if (provider.isTokenary)\n return \"Tokenary\";\n if (provider.isTrust || provider.isTrustWallet)\n return \"Trust Wallet\";\n if (provider.isTTWallet)\n return \"TTWallet\";\n if (provider.isXDEFI)\n return \"XDEFI Wallet\";\n if (provider.isZeal)\n return \"Zeal\";\n if (provider.isZerion)\n return \"Zerion\";\n if (provider.isMetaMask)\n return \"MetaMask\";\n };\n if (ethereum.providers?.length) {\n const nameSet = /* @__PURE__ */ new Set();\n let unknownCount = 1;\n for (const provider of ethereum.providers) {\n let name = getName(provider);\n if (!name) {\n name = `Unknown Wallet #${unknownCount}`;\n unknownCount += 1;\n }\n nameSet.add(name);\n }\n const names = [...nameSet];\n if (names.length)\n return names;\n return names[0] ?? \"Injected\";\n }\n return getName(ethereum) ?? \"Injected\";\n}\n\n// src/injected.ts\nvar _provider;\nvar InjectedConnector = class extends Connector {\n constructor({\n chains,\n options: options_\n } = {}) {\n const options = {\n shimDisconnect: true,\n getProvider() {\n if (typeof window === \"undefined\")\n return;\n const ethereum = window.ethereum;\n if (ethereum?.providers)\n return ethereum.providers[0];\n return ethereum;\n },\n ...options_\n };\n super({ chains, options });\n this.id = \"injected\";\n __privateAdd(this, _provider, void 0);\n this.shimDisconnectKey = `${this.id}.shimDisconnect`;\n this.onAccountsChanged = (accounts) => {\n if (accounts.length === 0)\n this.emit(\"disconnect\");\n else\n this.emit(\"change\", {\n account: getAddress(accounts[0])\n });\n };\n this.onChainChanged = (chainId) => {\n const id = normalizeChainId(chainId);\n const unsupported = this.isChainUnsupported(id);\n this.emit(\"change\", { chain: { id, unsupported } });\n };\n this.onDisconnect = async (error) => {\n if (error.code === 1013) {\n const provider = await this.getProvider();\n if (provider) {\n const isAuthorized = await this.getAccount();\n if (isAuthorized)\n return;\n }\n }\n this.emit(\"disconnect\");\n if (this.options.shimDisconnect)\n this.storage?.removeItem(this.shimDisconnectKey);\n };\n const provider = options.getProvider();\n if (typeof options.name === \"string\")\n this.name = options.name;\n else if (provider) {\n const detectedName = getInjectedName(provider);\n if (options.name)\n this.name = options.name(detectedName);\n else {\n if (typeof detectedName === \"string\")\n this.name = detectedName;\n else\n this.name = detectedName[0];\n }\n } else\n this.name = \"Injected\";\n this.ready = !!provider;\n }\n async connect({ chainId } = {}) {\n try {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n if (provider.on) {\n provider.on(\"accountsChanged\", this.onAccountsChanged);\n provider.on(\"chainChanged\", this.onChainChanged);\n provider.on(\"disconnect\", this.onDisconnect);\n }\n this.emit(\"message\", { type: \"connecting\" });\n const accounts = await provider.request({\n method: \"eth_requestAccounts\"\n });\n const account = getAddress(accounts[0]);\n let id = await this.getChainId();\n let unsupported = this.isChainUnsupported(id);\n if (chainId && id !== chainId) {\n const chain = await this.switchChain(chainId);\n id = chain.id;\n unsupported = this.isChainUnsupported(id);\n }\n if (this.options.shimDisconnect)\n this.storage?.setItem(this.shimDisconnectKey, true);\n return { account, chain: { id, unsupported } };\n } catch (error) {\n if (this.isUserRejectedRequestError(error))\n throw new UserRejectedRequestError(error);\n if (error.code === -32002)\n throw new ResourceUnavailableRpcError(error);\n throw error;\n }\n }\n async disconnect() {\n const provider = await this.getProvider();\n if (!provider?.removeListener)\n return;\n provider.removeListener(\"accountsChanged\", this.onAccountsChanged);\n provider.removeListener(\"chainChanged\", this.onChainChanged);\n provider.removeListener(\"disconnect\", this.onDisconnect);\n if (this.options.shimDisconnect)\n this.storage?.removeItem(this.shimDisconnectKey);\n }\n async getAccount() {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n const accounts = await provider.request({\n method: \"eth_accounts\"\n });\n return getAddress(accounts[0]);\n }\n async getChainId() {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n return provider.request({ method: \"eth_chainId\" }).then(normalizeChainId);\n }\n async getProvider() {\n const provider = this.options.getProvider();\n if (provider)\n __privateSet(this, _provider, provider);\n return __privateGet(this, _provider);\n }\n async getWalletClient({\n chainId\n } = {}) {\n const [provider, account] = await Promise.all([\n this.getProvider(),\n this.getAccount()\n ]);\n const chain = this.chains.find((x) => x.id === chainId);\n if (!provider)\n throw new Error(\"provider is required.\");\n return createWalletClient({\n account,\n chain,\n transport: custom(provider)\n });\n }\n async isAuthorized() {\n try {\n if (this.options.shimDisconnect && !this.storage?.getItem(this.shimDisconnectKey))\n return false;\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n const account = await this.getAccount();\n return !!account;\n } catch {\n return false;\n }\n }\n async switchChain(chainId) {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n const id = numberToHex(chainId);\n try {\n await Promise.all([\n provider.request({\n method: \"wallet_switchEthereumChain\",\n params: [{ chainId: id }]\n }),\n new Promise(\n (res) => this.on(\"change\", ({ chain }) => {\n if (chain?.id === chainId)\n res();\n })\n )\n ]);\n return this.chains.find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${id}`,\n network: `${id}`,\n nativeCurrency: { name: \"Ether\", decimals: 18, symbol: \"ETH\" },\n rpcUrls: { default: { http: [\"\"] }, public: { http: [\"\"] } }\n };\n } catch (error) {\n const chain = this.chains.find((x) => x.id === chainId);\n if (!chain)\n throw new ChainNotConfiguredForConnectorError({\n chainId,\n connectorId: this.id\n });\n if (error.code === 4902 || error?.data?.originalError?.code === 4902) {\n try {\n await provider.request({\n method: \"wallet_addEthereumChain\",\n params: [\n {\n chainId: id,\n chainName: chain.name,\n nativeCurrency: chain.nativeCurrency,\n rpcUrls: [chain.rpcUrls.public?.http[0] ?? \"\"],\n blockExplorerUrls: this.getBlockExplorerUrls(chain)\n }\n ]\n });\n const currentChainId = await this.getChainId();\n if (currentChainId !== chainId)\n throw new UserRejectedRequestError(\n new Error(\"User rejected switch after adding network.\")\n );\n return chain;\n } catch (error2) {\n throw new UserRejectedRequestError(error2);\n }\n }\n if (this.isUserRejectedRequestError(error))\n throw new UserRejectedRequestError(error);\n throw new SwitchChainError(error);\n }\n }\n async watchAsset({\n address,\n decimals = 18,\n image,\n symbol\n }) {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n return provider.request({\n method: \"wallet_watchAsset\",\n params: {\n type: \"ERC20\",\n options: {\n address,\n decimals,\n image,\n symbol\n }\n }\n });\n }\n isUserRejectedRequestError(error) {\n return error.code === 4001;\n }\n};\n_provider = new WeakMap();\n\nexport {\n InjectedConnector\n};\n","var __accessCheck = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n};\nvar __privateGet = (obj, member, getter) => {\n __accessCheck(obj, member, \"read from private field\");\n return getter ? getter.call(obj) : member.get(obj);\n};\nvar __privateAdd = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n};\nvar __privateSet = (obj, member, value, setter) => {\n __accessCheck(obj, member, \"write to private field\");\n setter ? setter.call(obj, value) : member.set(obj, value);\n return value;\n};\nvar __privateMethod = (obj, member, method) => {\n __accessCheck(obj, member, \"access private method\");\n return method;\n};\n\nexport {\n __privateGet,\n __privateAdd,\n __privateSet,\n __privateMethod\n};\n","import {\n InjectedConnector\n} from \"./chunk-BVC4KGLQ.js\";\nimport {\n __privateAdd,\n __privateGet,\n __privateMethod,\n __privateSet\n} from \"./chunk-MQXBDTVK.js\";\n\n// src/utils/configureChains.ts\nimport { createPublicClient, fallback, http, webSocket } from \"viem\";\nfunction configureChains(defaultChains, providers, {\n batch = { multicall: { wait: 32 } },\n pollingInterval = 4e3,\n rank,\n retryCount,\n retryDelay,\n stallTimeout\n} = {}) {\n if (!defaultChains.length)\n throw new Error(\"must have at least one chain\");\n let chains = [];\n const httpUrls = {};\n const wsUrls = {};\n for (const chain of defaultChains) {\n let configExists = false;\n for (const provider of providers) {\n const apiConfig = provider(chain);\n if (!apiConfig)\n continue;\n configExists = true;\n if (!chains.some(({ id }) => id === chain.id)) {\n chains = [...chains, apiConfig.chain];\n }\n httpUrls[chain.id] = [\n ...httpUrls[chain.id] || [],\n ...apiConfig.rpcUrls.http\n ];\n if (apiConfig.rpcUrls.webSocket) {\n wsUrls[chain.id] = [\n ...wsUrls[chain.id] || [],\n ...apiConfig.rpcUrls.webSocket\n ];\n }\n }\n if (!configExists) {\n throw new Error(\n [\n `Could not find valid provider configuration for chain \"${chain.name}\".\n`,\n \"You may need to add `jsonRpcProvider` to `configureChains` with the chain's RPC URLs.\",\n \"Read more: https://wagmi.sh/core/providers/jsonRpc\"\n ].join(\"\\n\")\n );\n }\n }\n return {\n chains,\n publicClient: ({ chainId }) => {\n const activeChain = chains.find((x) => x.id === chainId) ?? defaultChains[0];\n const chainHttpUrls = httpUrls[activeChain.id];\n if (!chainHttpUrls || !chainHttpUrls[0])\n throw new Error(`No providers configured for chain \"${activeChain.id}\"`);\n const publicClient = createPublicClient({\n batch,\n chain: activeChain,\n transport: fallback(\n chainHttpUrls.map((url) => http(url, { timeout: stallTimeout })),\n { rank, retryCount, retryDelay }\n ),\n pollingInterval\n });\n return Object.assign(publicClient, {\n chains\n });\n },\n webSocketPublicClient: ({ chainId }) => {\n const activeChain = chains.find((x) => x.id === chainId) ?? defaultChains[0];\n const chainWsUrls = wsUrls[activeChain.id];\n if (!chainWsUrls || !chainWsUrls[0])\n return void 0;\n const publicClient = createPublicClient({\n batch,\n chain: activeChain,\n transport: fallback(\n chainWsUrls.map((url) => webSocket(url, { timeout: stallTimeout })),\n { rank, retryCount, retryDelay }\n ),\n pollingInterval\n });\n return Object.assign(publicClient, {\n chains\n });\n }\n };\n}\n\n// src/errors.ts\nimport { ConnectorNotFoundError } from \"@wagmi/connectors\";\nvar ChainMismatchError = class extends Error {\n constructor({\n activeChain,\n targetChain\n }) {\n super(\n `Chain mismatch: Expected \"${targetChain}\", received \"${activeChain}\".`\n );\n this.name = \"ChainMismatchError\";\n }\n};\nvar ChainNotConfiguredError = class extends Error {\n constructor({\n chainId,\n connectorId\n }) {\n super(\n `Chain \"${chainId}\" not configured${connectorId ? ` for connector \"${connectorId}\"` : \"\"}.`\n );\n this.name = \"ChainNotConfigured\";\n }\n};\nvar ConnectorAlreadyConnectedError = class extends Error {\n constructor() {\n super(...arguments);\n this.name = \"ConnectorAlreadyConnectedError\";\n this.message = \"Connector already connected\";\n }\n};\nvar ConfigChainsNotFound = class extends Error {\n constructor() {\n super(...arguments);\n this.name = \"ConfigChainsNotFound\";\n this.message = \"No chains were found on the wagmi config. Some functions that require a chain may not work.\";\n }\n};\nvar SwitchChainNotSupportedError = class extends Error {\n constructor({ connector }) {\n super(`\"${connector.name}\" does not support programmatic chain switching.`);\n this.name = \"SwitchChainNotSupportedError\";\n }\n};\n\n// src/utils/deepEqual.ts\nfunction 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 return a !== a && b !== b;\n}\n\n// src/utils/deserialize.ts\nvar findAndReplace = (cacheRef, {\n find,\n replace\n}) => {\n if (cacheRef && find(cacheRef)) {\n return replace(cacheRef);\n }\n if (typeof cacheRef !== \"object\") {\n return cacheRef;\n }\n if (Array.isArray(cacheRef)) {\n return cacheRef.map((item) => findAndReplace(item, { find, replace }));\n }\n if (cacheRef instanceof Object) {\n return Object.entries(cacheRef).reduce(\n (curr, [key, value]) => ({\n ...curr,\n [key]: findAndReplace(value, { find, replace })\n }),\n {}\n );\n }\n return cacheRef;\n};\nfunction deserialize(cachedString) {\n const cache = JSON.parse(cachedString);\n const deserializedCacheWithBigInts = findAndReplace(cache, {\n find: (data) => typeof data === \"string\" && data.startsWith(\"#bigint.\"),\n replace: (data) => BigInt(data.replace(\"#bigint.\", \"\"))\n });\n return deserializedCacheWithBigInts;\n}\n\n// src/utils/getParameters.ts\nfunction getCallParameters(args) {\n return {\n accessList: args.accessList,\n account: args.account,\n blockNumber: args.blockNumber,\n blockTag: args.blockTag,\n data: args.data,\n gas: args.gas,\n gasPrice: args.gasPrice,\n maxFeePerGas: args.maxFeePerGas,\n maxPriorityFeePerGas: args.maxPriorityFeePerGas,\n nonce: args.nonce,\n to: args.to,\n value: args.value\n };\n}\nfunction getSendTransactionParameters(args) {\n return {\n accessList: args.accessList,\n account: args.account,\n data: args.data,\n gas: args.gas,\n gasPrice: args.gasPrice,\n maxFeePerGas: args.maxFeePerGas,\n maxPriorityFeePerGas: args.maxPriorityFeePerGas,\n nonce: args.nonce,\n to: args.to,\n value: args.value\n };\n}\n\n// src/utils/getUnit.ts\nimport { weiUnits } from \"viem\";\nfunction 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\n// src/utils/serialize.ts\nfunction getReferenceKey(keys, cutoff) {\n return keys.slice(0, cutoff).join(\".\") || \".\";\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}\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 } 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 ? circularReplacer.call(\n this,\n key,\n value,\n getReferenceKey(keys, valueCutoff)\n ) : `[ref=${getReferenceKey(keys, valueCutoff)}]`;\n }\n } else {\n cache[0] = value;\n keys[0] = key;\n }\n }\n return hasReplacer ? replacer.call(this, key, value) : value;\n };\n}\nfunction serialize(value, replacer, indent, circularReplacer) {\n return JSON.stringify(\n value,\n createReplacer((key, value_) => {\n const value2 = typeof value_ === \"bigint\" ? `#bigint.${value_.toString()}` : value_;\n return replacer?.(key, value2) || value2;\n }, circularReplacer),\n indent ?? void 0\n );\n}\n\n// src/config.ts\nimport { persist, subscribeWithSelector } from \"zustand/middleware\";\nimport { createStore } from \"zustand/vanilla\";\n\n// src/storage.ts\nvar noopStorage = {\n getItem: (_key) => \"\",\n setItem: (_key, _value) => null,\n removeItem: (_key) => null\n};\nfunction createStorage({\n deserialize: deserialize2 = deserialize,\n key: prefix = \"wagmi\",\n serialize: serialize2 = serialize,\n storage\n}) {\n return {\n ...storage,\n getItem: (key, defaultState = null) => {\n const value = storage.getItem(`${prefix}.${key}`);\n try {\n return value ? deserialize2(value) : defaultState;\n } catch (error) {\n console.warn(error);\n return defaultState;\n }\n },\n setItem: (key, value) => {\n if (value === null) {\n storage.removeItem(`${prefix}.${key}`);\n } else {\n try {\n storage.setItem(`${prefix}.${key}`, serialize2(value));\n } catch (err) {\n console.error(err);\n }\n }\n },\n removeItem: (key) => storage.removeItem(`${prefix}.${key}`)\n };\n}\n\n// src/config.ts\nvar storeKey = \"store\";\nvar _isAutoConnecting, _lastUsedConnector, _addEffects, addEffects_fn;\nvar Config = class {\n constructor({\n autoConnect = false,\n connectors = [new InjectedConnector()],\n publicClient,\n storage = createStorage({\n storage: typeof window !== \"undefined\" ? window.localStorage : noopStorage\n }),\n logger = {\n warn: console.warn\n },\n webSocketPublicClient\n }) {\n __privateAdd(this, _addEffects);\n this.publicClients = /* @__PURE__ */ new Map();\n this.webSocketPublicClients = /* @__PURE__ */ new Map();\n __privateAdd(this, _isAutoConnecting, void 0);\n __privateAdd(this, _lastUsedConnector, void 0);\n this.args = {\n autoConnect,\n connectors,\n logger,\n publicClient,\n storage,\n webSocketPublicClient\n };\n let status = \"disconnected\";\n let chainId;\n if (autoConnect) {\n try {\n const rawState = storage.getItem(storeKey);\n const data = rawState?.state?.data;\n status = data?.account ? \"reconnecting\" : \"connecting\";\n chainId = data?.chain?.id;\n } catch (_error) {\n }\n }\n const connectors_ = typeof connectors === \"function\" ? connectors() : connectors;\n connectors_.forEach((connector) => connector.setStorage(storage));\n this.store = createStore(\n subscribeWithSelector(\n persist(\n () => ({\n connectors: connectors_,\n publicClient: this.getPublicClient({ chainId }),\n status,\n webSocketPublicClient: this.getWebSocketPublicClient({ chainId })\n }),\n {\n name: storeKey,\n storage,\n partialize: (state) => ({\n ...autoConnect && {\n data: {\n account: state?.data?.account,\n chain: state?.data?.chain\n }\n },\n chains: state?.chains\n }),\n version: 2\n }\n )\n )\n );\n this.storage = storage;\n __privateSet(this, _lastUsedConnector, storage?.getItem(\"wallet\"));\n __privateMethod(this, _addEffects, addEffects_fn).call(this);\n if (autoConnect && typeof window !== \"undefined\")\n setTimeout(async () => await this.autoConnect(), 0);\n }\n get chains() {\n return this.store.getState().chains;\n }\n get connectors() {\n return this.store.getState().connectors;\n }\n get connector() {\n return this.store.getState().connector;\n }\n get data() {\n return this.store.getState().data;\n }\n get error() {\n return this.store.getState().error;\n }\n get lastUsedChainId() {\n return this.data?.chain?.id;\n }\n get publicClient() {\n return this.store.getState().publicClient;\n }\n get status() {\n return this.store.getState().status;\n }\n get subscribe() {\n return this.store.subscribe;\n }\n get webSocketPublicClient() {\n return this.store.getState().webSocketPublicClient;\n }\n setState(updater) {\n const newState = typeof updater === \"function\" ? updater(this.store.getState()) : updater;\n this.store.setState(newState, true);\n }\n clearState() {\n this.setState((x) => ({\n ...x,\n chains: void 0,\n connector: void 0,\n data: void 0,\n error: void 0,\n status: \"disconnected\"\n }));\n }\n async destroy() {\n if (this.connector)\n await this.connector.disconnect?.();\n __privateSet(this, _isAutoConnecting, false);\n this.clearState();\n this.store.destroy();\n }\n async autoConnect() {\n if (__privateGet(this, _isAutoConnecting))\n return;\n __privateSet(this, _isAutoConnecting, true);\n this.setState((x) => ({\n ...x,\n status: x.data?.account ? \"reconnecting\" : \"connecting\"\n }));\n const sorted = __privateGet(this, _lastUsedConnector) ? [...this.connectors].sort(\n (x) => x.id === __privateGet(this, _lastUsedConnector) ? -1 : 1\n ) : this.connectors;\n let connected = false;\n for (const connector of sorted) {\n if (!connector.ready || !connector.isAuthorized)\n continue;\n const isAuthorized = await connector.isAuthorized();\n if (!isAuthorized)\n continue;\n const data = await connector.connect();\n this.setState((x) => ({\n ...x,\n connector,\n chains: connector?.chains,\n data,\n status: \"connected\"\n }));\n connected = true;\n break;\n }\n if (!connected)\n this.setState((x) => ({\n ...x,\n data: void 0,\n status: \"disconnected\"\n }));\n __privateSet(this, _isAutoConnecting, false);\n return this.data;\n }\n setConnectors(connectors) {\n this.args = {\n ...this.args,\n connectors\n };\n const connectors_ = typeof connectors === \"function\" ? connectors() : connectors;\n connectors_.forEach((connector) => connector.setStorage(this.args.storage));\n this.setState((x) => ({\n ...x,\n connectors: connectors_\n }));\n }\n getPublicClient({ chainId } = {}) {\n let publicClient_ = this.publicClients.get(-1);\n if (publicClient_ && publicClient_?.chain.id === chainId)\n return publicClient_;\n publicClient_ = this.publicClients.get(chainId ?? -1);\n if (publicClient_)\n return publicClient_;\n const { publicClient } = this.args;\n publicClient_ = typeof publicClient === \"function\" ? publicClient({ chainId }) : publicClient;\n this.publicClients.set(chainId ?? -1, publicClient_);\n return publicClient_;\n }\n setPublicClient(publicClient) {\n const chainId = this.data?.chain?.id;\n this.args = {\n ...this.args,\n publicClient\n };\n this.publicClients.clear();\n this.setState((x) => ({\n ...x,\n publicClient: this.getPublicClient({ chainId })\n }));\n }\n getWebSocketPublicClient({ chainId } = {}) {\n let webSocketPublicClient_ = this.webSocketPublicClients.get(-1);\n if (webSocketPublicClient_ && webSocketPublicClient_?.chain.id === chainId)\n return webSocketPublicClient_;\n webSocketPublicClient_ = this.webSocketPublicClients.get(chainId ?? -1);\n if (webSocketPublicClient_)\n return webSocketPublicClient_;\n const { webSocketPublicClient } = this.args;\n webSocketPublicClient_ = typeof webSocketPublicClient === \"function\" ? webSocketPublicClient({ chainId }) : webSocketPublicClient;\n if (webSocketPublicClient_)\n this.webSocketPublicClients.set(chainId ?? -1, webSocketPublicClient_);\n return webSocketPublicClient_;\n }\n setWebSocketPublicClient(webSocketPublicClient) {\n const chainId = this.data?.chain?.id;\n this.args = {\n ...this.args,\n webSocketPublicClient\n };\n this.webSocketPublicClients.clear();\n this.setState((x) => ({\n ...x,\n webSocketPublicClient: this.getWebSocketPublicClient({\n chainId\n })\n }));\n }\n setLastUsedConnector(lastUsedConnector = null) {\n this.storage?.setItem(\"wallet\", lastUsedConnector);\n }\n};\n_isAutoConnecting = new WeakMap();\n_lastUsedConnector = new WeakMap();\n_addEffects = new WeakSet();\naddEffects_fn = function() {\n const onChange = (data) => {\n this.setState((x) => ({\n ...x,\n data: { ...x.data, ...data }\n }));\n };\n const onDisconnect = () => {\n this.clearState();\n };\n const onError = (error) => {\n this.setState((x) => ({ ...x, error }));\n };\n this.store.subscribe(\n ({ connector }) => connector,\n (connector, prevConnector) => {\n prevConnector?.off?.(\"change\", onChange);\n prevConnector?.off?.(\"disconnect\", onDisconnect);\n prevConnector?.off?.(\"error\", onError);\n if (!connector)\n return;\n connector.on?.(\"change\", onChange);\n connector.on?.(\"disconnect\", onDisconnect);\n connector.on?.(\"error\", onError);\n }\n );\n const { publicClient, webSocketPublicClient } = this.args;\n const subscribePublicClient = typeof publicClient === \"function\";\n const subscribeWebSocketPublicClient = typeof webSocketPublicClient === \"function\";\n if (subscribePublicClient || subscribeWebSocketPublicClient)\n this.store.subscribe(\n ({ data }) => data?.chain?.id,\n (chainId) => {\n this.setState((x) => ({\n ...x,\n publicClient: this.getPublicClient({ chainId }),\n webSocketPublicClient: this.getWebSocketPublicClient({\n chainId\n })\n }));\n }\n );\n};\nvar config;\nfunction createConfig(args) {\n const config_ = new Config(args);\n config = config_;\n return config_;\n}\nfunction getConfig() {\n if (!config) {\n throw new Error(\n \"No wagmi config found. Ensure you have set up a config: https://wagmi.sh/react/config\"\n );\n }\n return config;\n}\n\n// src/actions/accounts/connect.ts\nasync function connect({ chainId, connector }) {\n const config2 = getConfig();\n const activeConnector = config2.connector;\n if (activeConnector && connector.id === activeConnector.id)\n throw new ConnectorAlreadyConnectedError();\n try {\n config2.setState((x) => ({ ...x, status: \"connecting\" }));\n const data = await connector.connect({ chainId });\n config2.setLastUsedConnector(connector.id);\n config2.setState((x) => ({\n ...x,\n connector,\n chains: connector?.chains,\n data,\n status: \"connected\"\n }));\n config2.storage.setItem(\"connected\", true);\n return { ...data, connector };\n } catch (err) {\n config2.setState((x) => {\n return {\n ...x,\n status: x.connector ? \"connected\" : \"disconnected\"\n };\n });\n throw err;\n }\n}\n\n// src/actions/accounts/disconnect.ts\nasync function disconnect() {\n const config2 = getConfig();\n if (config2.connector)\n await config2.connector.disconnect();\n config2.clearState();\n config2.storage.removeItem(\"connected\");\n}\n\n// src/actions/accounts/fetchBalance.ts\nimport {\n ContractFunctionExecutionError as ContractFunctionExecutionError3,\n formatUnits as formatUnits2,\n hexToString as hexToString2,\n trim as trim2\n} from \"viem\";\n\n// src/constants/abis.ts\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"uint256\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"decimals\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint8\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"name\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"string\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"symbol\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"string\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"totalSupply\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"bool\"\n }\n ]\n }\n];\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"uint256\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"decimals\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint8\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"name\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"symbol\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"totalSupply\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"bool\"\n }\n ]\n }\n];\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"bool\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"name\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"string\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"totalSupply\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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];\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\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\n// src/actions/contracts/fetchToken.ts\nimport {\n ContractFunctionExecutionError,\n formatUnits,\n hexToString,\n trim\n} from \"viem\";\nasync function fetchToken({\n address,\n chainId,\n formatUnits: unit = 18\n}) {\n async function fetchToken_({ abi }) {\n const erc20Config = { address, abi, chainId };\n const [decimals, name, symbol, totalSupply] = await readContracts({\n allowFailure: false,\n contracts: [\n { ...erc20Config, functionName: \"decimals\" },\n { ...erc20Config, functionName: \"name\" },\n { ...erc20Config, functionName: \"symbol\" },\n { ...erc20Config, functionName: \"totalSupply\" }\n ]\n });\n return {\n address,\n decimals,\n name,\n symbol,\n totalSupply: {\n formatted: formatUnits(totalSupply, getUnit(unit)),\n value: totalSupply\n }\n };\n }\n try {\n return await fetchToken_({ abi: erc20ABI });\n } catch (err) {\n if (err instanceof ContractFunctionExecutionError) {\n const { name, symbol, ...rest } = await fetchToken_({\n abi: erc20ABI_bytes32\n });\n return {\n name: hexToString(trim(name, { dir: \"right\" })),\n symbol: hexToString(trim(symbol, { dir: \"right\" })),\n ...rest\n };\n }\n throw err;\n }\n}\n\n// src/actions/viem/getPublicClient.ts\nfunction getPublicClient({ chainId } = {}) {\n const config2 = getConfig();\n if (chainId)\n return config2.getPublicClient({ chainId }) || config2.publicClient;\n return config2.publicClient;\n}\n\n// src/actions/viem/getWalletClient.ts\nasync function getWalletClient({\n chainId\n} = {}) {\n const config2 = getConfig();\n const walletClient = await config2.connector?.getWalletClient?.({ chainId }) || null;\n return walletClient;\n}\n\n// src/actions/viem/getWebSocketPublicClient.ts\nfunction getWebSocketPublicClient({\n chainId\n} = {}) {\n const config2 = getConfig();\n if (chainId)\n return config2.getWebSocketPublicClient({ chainId }) || config2.webSocketPublicClient;\n return config2.webSocketPublicClient;\n}\n\n// src/actions/viem/watchPublicClient.ts\nfunction watchPublicClient(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(getPublicClient(args));\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return unsubscribe;\n}\n\n// src/actions/viem/watchWalletClient.ts\nimport { shallow } from \"zustand/shallow\";\nfunction watchWalletClient({ chainId }, callback) {\n const config2 = getConfig();\n const handleChange = async ({ chainId: chainId_ }) => {\n if (chainId && chainId_ && chainId !== chainId_)\n return;\n const walletClient = await getWalletClient({ chainId });\n if (!getConfig().connector)\n return callback(null);\n return callback(walletClient);\n };\n const unsubscribe = config2.subscribe(\n ({ data, connector }) => ({\n account: data?.account,\n chainId: data?.chain?.id,\n connector\n }),\n handleChange,\n {\n equalityFn: shallow\n }\n );\n return unsubscribe;\n}\n\n// src/actions/viem/watchWebSocketPublicClient.ts\nfunction watchWebSocketPublicClient(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(getWebSocketPublicClient(args));\n const unsubscribe = config2.subscribe(\n ({ webSocketPublicClient }) => webSocketPublicClient,\n handleChange\n );\n return unsubscribe;\n}\n\n// src/actions/contracts/prepareWriteContract.ts\nasync function prepareWriteContract({\n abi,\n address,\n args,\n chainId,\n dataSuffix,\n functionName,\n walletClient: walletClient_,\n ...config2\n}) {\n const publicClient = getPublicClient({ chainId });\n const walletClient = walletClient_ ?? await getWalletClient({ chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (chainId)\n assertActiveChain({ chainId });\n const {\n account,\n accessList,\n blockNumber,\n blockTag,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n value\n } = getCallParameters(config2);\n const { result, request } = await publicClient.simulateContract({\n abi,\n address,\n functionName,\n args,\n account: account || walletClient.account,\n accessList,\n blockNumber,\n blockTag,\n dataSuffix,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n value\n });\n const minimizedAbi = abi.filter(\n (abiItem) => \"name\" in abiItem && abiItem.name === functionName\n );\n return {\n mode: \"prepared\",\n request: {\n ...request,\n abi: minimizedAbi,\n chainId\n },\n result\n };\n}\n\n// src/actions/contracts/getContract.ts\nimport { getContract as getContract_ } from \"viem\";\nfunction getContract({\n address,\n abi,\n chainId,\n walletClient\n}) {\n const publicClient = getPublicClient({ chainId });\n return getContract_({\n address,\n abi,\n publicClient,\n walletClient\n });\n}\n\n// src/actions/contracts/multicall.ts\nasync function multicall({\n chainId,\n contracts,\n blockNumber,\n blockTag,\n ...args\n}) {\n const publicClient = getPublicClient({ chainId });\n if (!publicClient.chains)\n throw new ConfigChainsNotFound();\n if (chainId && publicClient.chain.id !== chainId)\n throw new ChainNotConfiguredError({ chainId });\n return publicClient.multicall({\n allowFailure: args.allowFailure ?? true,\n blockNumber,\n blockTag,\n contracts\n });\n}\n\n// src/actions/contracts/readContract.ts\nasync function readContract({\n address,\n account,\n chainId,\n abi,\n args,\n functionName,\n blockNumber,\n blockTag\n}) {\n const publicClient = getPublicClient({ chainId });\n return publicClient.readContract({\n abi,\n address,\n account,\n functionName,\n args,\n blockNumber,\n blockTag\n });\n}\n\n// src/actions/contracts/readContracts.ts\nimport { ContractFunctionExecutionError as ContractFunctionExecutionError2 } from \"viem\";\nasync function readContracts({\n contracts,\n blockNumber,\n blockTag,\n ...args\n}) {\n const { allowFailure = true } = args;\n try {\n const publicClient = getPublicClient();\n const contractsByChainId = contracts.reduce((contracts2, contract, index) => {\n const chainId = contract.chainId ?? publicClient.chain.id;\n return {\n ...contracts2,\n [chainId]: [...contracts2[chainId] || [], { contract, index }]\n };\n }, {});\n const promises = () => Object.entries(contractsByChainId).map(\n ([chainId, contracts2]) => multicall({\n allowFailure,\n chainId: parseInt(chainId),\n contracts: contracts2.map(\n ({ contract }) => contract\n ),\n blockNumber,\n blockTag\n })\n );\n const multicallResults = (await Promise.all(promises())).flat();\n const resultIndexes = Object.values(contractsByChainId).flatMap(\n (contracts2) => contracts2.map(({ index }) => index)\n );\n return multicallResults.reduce((results, result, index) => {\n if (results)\n results[resultIndexes[index]] = result;\n return results;\n }, []);\n } catch (err) {\n if (err instanceof ContractFunctionExecutionError2)\n throw err;\n const promises = () => contracts.map(\n (contract) => readContract({ ...contract, blockNumber, blockTag })\n );\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: void 0, status: \"failure\" };\n });\n return await Promise.all(promises());\n }\n}\n\n// src/actions/contracts/watchContractEvent.ts\nimport { shallow as shallow2 } from \"zustand/shallow\";\nfunction watchContractEvent({\n address,\n abi,\n chainId,\n eventName\n}, callback) {\n let unwatch;\n const watchEvent = async () => {\n if (unwatch)\n unwatch();\n const publicClient = getWebSocketPublicClient({ chainId }) || getPublicClient({ chainId });\n unwatch = publicClient.watchContractEvent({\n address,\n abi,\n eventName,\n onLogs: callback\n });\n };\n watchEvent();\n const config2 = getConfig();\n const unsubscribe = config2.subscribe(\n ({ publicClient, webSocketPublicClient }) => ({\n publicClient,\n webSocketPublicClient\n }),\n watchEvent,\n { equalityFn: shallow2 }\n );\n return () => {\n unwatch?.();\n unsubscribe();\n };\n}\n\n// src/actions/network-status/watchBlockNumber.ts\nimport { shallow as shallow3 } from \"zustand/shallow\";\nfunction watchBlockNumber(args, callback) {\n let unwatch;\n const createListener = (publicClient) => {\n if (unwatch)\n unwatch();\n unwatch = publicClient.watchBlockNumber({\n onBlockNumber: callback,\n emitOnBegin: true,\n poll: true\n });\n };\n const publicClient_ = getWebSocketPublicClient({ chainId: args.chainId }) ?? getPublicClient({ chainId: args.chainId });\n if (args.listen)\n createListener(publicClient_);\n const config2 = getConfig();\n const unsubscribe = config2.subscribe(\n ({ publicClient, webSocketPublicClient }) => ({\n publicClient,\n webSocketPublicClient\n }),\n async ({ publicClient, webSocketPublicClient }) => {\n const publicClient_2 = webSocketPublicClient ?? publicClient;\n if (args.listen && !args.chainId && publicClient_2) {\n createListener(publicClient_2);\n }\n },\n {\n equalityFn: shallow3\n }\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/watchMulticall.ts\nfunction watchMulticall(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(await multicall(args));\n const unwatch = args.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : void 0;\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/watchReadContract.ts\nfunction watchReadContract(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(await readContract(args));\n const unwatch = args.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : void 0;\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/watchReadContracts.ts\nfunction watchReadContracts(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(await readContracts(args));\n const unwatch = args.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : void 0;\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/writeContract.ts\nasync function writeContract(config2) {\n const walletClient = await getWalletClient({ chainId: config2.chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (config2.chainId)\n assertActiveChain({ chainId: config2.chainId });\n let request;\n if (config2.mode === \"prepared\") {\n request = config2.request;\n } else {\n const { chainId: _, mode: __, ...args } = config2;\n const res = await prepareWriteContract(args);\n request = res.request;\n }\n const hash = await walletClient.writeContract({\n ...request,\n chain: config2.chainId ? { id: config2.chainId } : null\n });\n return { hash };\n}\n\n// src/actions/accounts/fetchBalance.ts\nasync function fetchBalance({\n address,\n chainId,\n formatUnits: unit,\n token\n}) {\n const config2 = getConfig();\n const publicClient = getPublicClient({ chainId });\n if (token) {\n const fetchContractBalance = async ({ abi }) => {\n const erc20Config = { abi, address: token, chainId };\n const [value2, decimals, symbol] = await readContracts({\n allowFailure: false,\n contracts: [\n {\n ...erc20Config,\n functionName: \"balanceOf\",\n args: [address]\n },\n { ...erc20Config, functionName: \"decimals\" },\n { ...erc20Config, functionName: \"symbol\" }\n ]\n });\n return {\n decimals,\n formatted: formatUnits2(value2 ?? \"0\", getUnit(unit ?? decimals)),\n symbol,\n value: value2\n };\n };\n try {\n return await fetchContractBalance({ abi: erc20ABI });\n } catch (err) {\n if (err instanceof ContractFunctionExecutionError3) {\n const { symbol, ...rest } = await fetchContractBalance({\n abi: erc20ABI_bytes32\n });\n return {\n symbol: hexToString2(trim2(symbol, { dir: \"right\" })),\n ...rest\n };\n }\n throw err;\n }\n }\n const chains = [\n ...config2.publicClient.chains || [],\n ...config2.chains ?? []\n ];\n const value = await publicClient.getBalance({ address });\n const chain = chains.find((x) => x.id === publicClient.chain.id);\n return {\n decimals: chain?.nativeCurrency.decimals ?? 18,\n formatted: formatUnits2(value ?? \"0\", getUnit(unit ?? 18)),\n symbol: chain?.nativeCurrency.symbol ?? \"ETH\",\n value\n };\n}\n\n// src/actions/accounts/getAccount.ts\nfunction getAccount() {\n const { data, connector, status } = getConfig();\n switch (status) {\n case \"connected\":\n return {\n address: data?.account,\n connector,\n isConnected: true,\n isConnecting: false,\n isDisconnected: false,\n isReconnecting: false,\n status\n };\n case \"reconnecting\":\n return {\n address: data?.account,\n connector,\n isConnected: !!data?.account,\n isConnecting: false,\n isDisconnected: false,\n isReconnecting: true,\n status\n };\n case \"connecting\":\n return {\n address: data?.account,\n connector,\n isConnected: false,\n isConnecting: true,\n isDisconnected: false,\n isReconnecting: false,\n status\n };\n case \"disconnected\":\n return {\n address: void 0,\n connector: void 0,\n isConnected: false,\n isConnecting: false,\n isDisconnected: true,\n isReconnecting: false,\n status\n };\n }\n}\n\n// src/actions/accounts/getNetwork.ts\nfunction getNetwork() {\n const config2 = getConfig();\n const chainId = config2.data?.chain?.id;\n const activeChains = config2.chains ?? [];\n const activeChain = [\n ...config2.publicClient?.chains || [],\n ...activeChains\n ].find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${chainId}`,\n network: `${chainId}`,\n nativeCurrency: { name: \"Ether\", decimals: 18, symbol: \"ETH\" },\n rpcUrls: {\n default: { http: [\"\"] },\n public: { http: [\"\"] }\n }\n };\n return {\n chain: chainId ? {\n ...activeChain,\n ...config2.data?.chain,\n id: chainId\n } : void 0,\n chains: activeChains\n };\n}\n\n// src/actions/accounts/signMessage.ts\nasync function signMessage(args) {\n const walletClient = await getWalletClient();\n if (!walletClient)\n throw new ConnectorNotFoundError();\n return await walletClient.signMessage({\n message: args.message\n });\n}\n\n// src/actions/accounts/signTypedData.ts\nasync function signTypedData({\n domain,\n message,\n primaryType,\n types\n}) {\n const walletClient = await getWalletClient();\n if (!walletClient)\n throw new ConnectorNotFoundError();\n const { chainId } = domain;\n if (chainId)\n assertActiveChain({ chainId });\n return walletClient.signTypedData({\n message,\n primaryType,\n types,\n domain\n });\n}\n\n// src/actions/accounts/switchNetwork.ts\nasync function switchNetwork({\n chainId\n}) {\n const { connector } = getConfig();\n if (!connector)\n throw new ConnectorNotFoundError();\n if (!connector.switchChain)\n throw new SwitchChainNotSupportedError({\n connector\n });\n return connector.switchChain(chainId);\n}\n\n// src/actions/accounts/watchAccount.ts\nimport { shallow as shallow4 } from \"zustand/shallow\";\nfunction watchAccount(callback, { selector = (x) => x } = {}) {\n const config2 = getConfig();\n const handleChange = () => callback(getAccount());\n const unsubscribe = config2.subscribe(\n ({ data, connector, status }) => selector({\n address: data?.account,\n connector,\n status\n }),\n handleChange,\n {\n equalityFn: shallow4\n }\n );\n return unsubscribe;\n}\n\n// src/actions/accounts/watchNetwork.ts\nimport { shallow as shallow5 } from \"zustand/shallow\";\nfunction watchNetwork(callback, { selector = (x) => x } = {}) {\n const config2 = getConfig();\n const handleChange = () => callback(getNetwork());\n const unsubscribe = config2.subscribe(\n ({ data, chains }) => selector({ chainId: data?.chain?.id, chains }),\n handleChange,\n {\n equalityFn: shallow5\n }\n );\n return unsubscribe;\n}\n\n// src/actions/ens/fetchEnsAddress.ts\nimport { getAddress } from \"viem\";\nasync function fetchEnsAddress({\n chainId,\n name\n}) {\n const { normalize } = await import(\"viem/ens\");\n const publicClient = getPublicClient({ chainId });\n const address = await publicClient.getEnsAddress({\n name: normalize(name)\n });\n try {\n if (address === \"0x0000000000000000000000000000000000000000\")\n return null;\n return address ? getAddress(address) : null;\n } catch (_error) {\n return null;\n }\n}\n\n// src/actions/ens/fetchEnsAvatar.ts\nasync function fetchEnsAvatar({\n name,\n chainId\n}) {\n const { normalize } = await import(\"viem/ens\");\n const publicClient = getPublicClient({ chainId });\n const avatar = await publicClient.getEnsAvatar({ name: normalize(name) });\n return avatar;\n}\n\n// src/actions/ens/fetchEnsName.ts\nimport { getAddress as getAddress2 } from \"viem\";\nasync function fetchEnsName({\n address,\n chainId\n}) {\n const publicClient = getPublicClient({ chainId });\n return publicClient.getEnsName({\n address: getAddress2(address)\n });\n}\n\n// src/actions/ens/fetchEnsResolver.ts\nasync function fetchEnsResolver({\n chainId,\n name\n}) {\n const { normalize } = await import(\"viem/ens\");\n const publicClient = getPublicClient({ chainId });\n const resolver = await publicClient.getEnsResolver({ name: normalize(name) });\n return resolver;\n}\n\n// src/actions/network-status/fetchBlockNumber.ts\nasync function fetchBlockNumber({\n chainId\n} = {}) {\n const publicClient = getPublicClient({ chainId });\n const blockNumber = await publicClient.getBlockNumber();\n return blockNumber;\n}\n\n// src/actions/network-status/fetchFeeData.ts\nimport { formatUnits as formatUnits3, parseGwei } from \"viem\";\nasync function fetchFeeData({\n chainId,\n formatUnits: units = \"gwei\"\n} = {}) {\n const publicClient = getPublicClient({ chainId });\n const block = await publicClient.getBlock();\n let gasPrice = null;\n try {\n gasPrice = await publicClient.getGasPrice();\n } catch {\n }\n let lastBaseFeePerGas = null;\n let maxFeePerGas = null;\n let maxPriorityFeePerGas = null;\n if (block?.baseFeePerGas) {\n lastBaseFeePerGas = block.baseFeePerGas;\n maxPriorityFeePerGas = parseGwei(\"1\");\n maxFeePerGas = block.baseFeePerGas * 2n + maxPriorityFeePerGas;\n }\n const unit = getUnit(units);\n const formatted = {\n gasPrice: gasPrice ? formatUnits3(gasPrice, unit) : null,\n maxFeePerGas: maxFeePerGas ? formatUnits3(maxFeePerGas, unit) : null,\n maxPriorityFeePerGas: maxPriorityFeePerGas ? formatUnits3(maxPriorityFeePerGas, unit) : null\n };\n return {\n lastBaseFeePerGas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n formatted\n };\n}\n\n// src/actions/transactions/fetchTransaction.ts\nasync function fetchTransaction({\n chainId,\n hash\n}) {\n const publicClient = getPublicClient({ chainId });\n return publicClient.getTransaction({ hash });\n}\n\n// src/actions/transactions/prepareSendTransaction.ts\nimport { isAddress } from \"viem\";\nasync function prepareSendTransaction({\n accessList,\n account,\n chainId,\n data,\n gas: gas_,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to: to_,\n value,\n walletClient: walletClient_\n}) {\n const publicClient = getPublicClient({ chainId });\n const walletClient = walletClient_ ?? await getWalletClient({ chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (chainId)\n assertActiveChain({ chainId });\n const to = (to_ && !isAddress(to_) ? await fetchEnsAddress({ name: to_ }) : to_) || void 0;\n if (to && !isAddress(to))\n throw new Error(\"Invalid address\");\n const gas = typeof gas_ === \"undefined\" ? await publicClient.estimateGas({\n accessList,\n account: walletClient.account,\n data,\n gas: gas_ ?? void 0,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value\n }) : gas_ || void 0;\n return {\n accessList,\n account,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n mode: \"prepared\",\n nonce,\n to,\n value,\n ...chainId ? { chainId } : {}\n };\n}\n\n// src/actions/transactions/sendTransaction.ts\nasync function sendTransaction({\n accessList,\n account,\n chainId,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n mode,\n nonce,\n to,\n value\n}) {\n const walletClient = await getWalletClient({ chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (chainId)\n assertActiveChain({ chainId });\n let args;\n if (mode === \"prepared\") {\n args = {\n account,\n accessList,\n chain: null,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value\n };\n } else {\n args = await prepareSendTransaction({\n accessList,\n account,\n chainId,\n data,\n gas: gas || null,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value\n });\n }\n const hash = await walletClient.sendTransaction({\n ...args,\n chain: chainId ? { id: chainId } : null\n });\n return { hash };\n}\n\n// src/actions/transactions/waitForTransaction.ts\nimport { hexToString as hexToString3 } from \"viem\";\nasync function waitForTransaction({\n chainId,\n confirmations = 1,\n hash,\n onReplaced,\n timeout = 0\n}) {\n const publicClient = getPublicClient({ chainId });\n const receipt = await publicClient.waitForTransactionReceipt({\n hash,\n confirmations,\n onReplaced,\n timeout\n });\n if (receipt.status === \"reverted\") {\n const txn = await publicClient.getTransaction({\n hash: receipt.transactionHash\n });\n const code = await publicClient.call({\n ...txn,\n gasPrice: txn.type !== \"eip1559\" ? txn.gasPrice : void 0,\n maxFeePerGas: txn.type === \"eip1559\" ? txn.maxFeePerGas : void 0,\n maxPriorityFeePerGas: txn.type === \"eip1559\" ? txn.maxPriorityFeePerGas : void 0\n });\n const reason = hexToString3(`0x${code.substring(138)}`);\n throw new Error(reason);\n }\n return receipt;\n}\n\n// src/actions/transactions/watchPendingTransactions.ts\nimport { shallow as shallow6 } from \"zustand/shallow\";\nfunction watchPendingTransactions(args, callback) {\n let unwatch;\n const createListener = (publicClient) => {\n if (unwatch)\n unwatch();\n unwatch = publicClient.watchPendingTransactions({\n onTransactions: callback,\n poll: true\n });\n };\n const publicClient_ = getWebSocketPublicClient({ chainId: args.chainId }) ?? getPublicClient({ chainId: args.chainId });\n createListener(publicClient_);\n const config2 = getConfig();\n const unsubscribe = config2.subscribe(\n ({ publicClient, webSocketPublicClient }) => ({\n publicClient,\n webSocketPublicClient\n }),\n async ({ publicClient, webSocketPublicClient }) => {\n const publicClient_2 = webSocketPublicClient ?? publicClient;\n if (!args.chainId && publicClient_2) {\n createListener(publicClient_2);\n }\n },\n {\n equalityFn: shallow6\n }\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/utils/assertActiveChain.ts\nfunction assertActiveChain({ chainId }) {\n const { chain: activeChain, chains } = getNetwork();\n const activeChainId = activeChain?.id;\n if (activeChainId && chainId !== activeChainId) {\n throw new ChainMismatchError({\n activeChain: chains.find((x) => x.id === activeChainId)?.name ?? `Chain ${activeChainId}`,\n targetChain: chains.find((x) => x.id === chainId)?.name ?? `Chain ${chainId}`\n });\n }\n}\n\nexport {\n configureChains,\n ChainMismatchError,\n ChainNotConfiguredError,\n ConnectorAlreadyConnectedError,\n ConfigChainsNotFound,\n SwitchChainNotSupportedError,\n ConnectorNotFoundError,\n deepEqual,\n deserialize,\n getCallParameters,\n getSendTransactionParameters,\n getUnit,\n serialize,\n noopStorage,\n createStorage,\n Config,\n createConfig,\n getConfig,\n connect,\n disconnect,\n erc20ABI,\n erc721ABI,\n erc4626ABI,\n fetchToken,\n getPublicClient,\n getWalletClient,\n getWebSocketPublicClient,\n watchPublicClient,\n watchWalletClient,\n watchWebSocketPublicClient,\n prepareWriteContract,\n getContract,\n multicall,\n readContract,\n readContracts,\n watchContractEvent,\n watchBlockNumber,\n watchMulticall,\n watchReadContract,\n watchReadContracts,\n writeContract,\n fetchBalance,\n getAccount,\n getNetwork,\n signMessage,\n signTypedData,\n switchNetwork,\n watchAccount,\n watchNetwork,\n fetchEnsAddress,\n fetchEnsAvatar,\n fetchEnsName,\n fetchEnsResolver,\n fetchBlockNumber,\n fetchFeeData,\n fetchTransaction,\n prepareSendTransaction,\n sendTransaction,\n waitForTransaction,\n watchPendingTransactions\n};\n","import { MockProvider, MockProviderOptions } from '@wagmi/connectors/mock';\nimport { Connector, ConnectorData, WalletClient } from '@wagmi/core';\nimport { createWalletClient, getAddress, Hex, http, zeroAddress } from 'viem';\nimport type { Chain } from 'viem/chains';\nimport { mainnet } from 'viem/chains';\n\nexport function normalizeChainId(chainId: string | number | bigint) {\n if (typeof chainId === 'string')\n return Number.parseInt(\n chainId,\n chainId.trim().substring(0, 2) === '0x' ? 16 : 10,\n );\n if (typeof chainId === 'bigint') return Number(chainId);\n return chainId;\n}\n\ntype MockConnectorOptions = Omit<\n MockProviderOptions,\n 'chainId' | 'walletClient'\n> & {\n chainId?: number;\n};\n\nexport class ImpersonatedConnector extends Connector<\n MockProvider,\n MockConnectorOptions\n> {\n readonly id = 'impersonated';\n readonly name = 'Impersonated';\n readonly ready = true;\n private accountAddress: Hex;\n\n #provider?: MockProvider;\n\n constructor({\n chains,\n options,\n }: {\n chains?: Chain[];\n options: MockConnectorOptions;\n }) {\n super({\n chains,\n options: {\n ...options,\n chainId: options.chainId ?? chains?.[0]?.id,\n },\n });\n this.accountAddress = zeroAddress;\n }\n\n setAccountAddress(address: Hex | undefined) {\n this.accountAddress = address || zeroAddress;\n }\n\n async connect({ chainId }: { address?: Hex; chainId?: number } = {}) {\n const provider = await this.getProvider({\n address: this.accountAddress,\n chainId,\n });\n provider.on('accountsChanged', this.onAccountsChanged);\n provider.on('chainChanged', this.onChainChanged);\n provider.on('disconnect', this.onDisconnect);\n\n this.emit('message', { type: 'connecting' });\n\n const accounts = await provider.enable();\n const account = getAddress(accounts[0] as string);\n const id = normalizeChainId(provider.chainId);\n const unsupported = this.isChainUnsupported(id);\n const data = { account, chain: { id, unsupported }, provider };\n\n if (!this.options.flags?.noSwitchChain)\n this.switchChain = this.#switchChain;\n\n return new Promise>((res) =>\n setTimeout(() => res(data), 100),\n );\n }\n\n async disconnect() {\n const provider = await this.getProvider();\n await provider.disconnect();\n\n provider.removeListener('accountsChanged', this.onAccountsChanged);\n provider.removeListener('chainChanged', this.onChainChanged);\n provider.removeListener('disconnect', this.onDisconnect);\n }\n\n async getAccount() {\n const provider = await this.getProvider();\n const accounts = await provider.getAccounts();\n const account = accounts[0];\n if (!account) throw new Error('Failed to get account');\n // return checksum address\n return getAddress(account);\n }\n\n async getChainId() {\n const provider = await this.getProvider();\n return normalizeChainId(provider.chainId);\n }\n\n async getProvider({\n address,\n chainId,\n }: { address?: Hex; chainId?: number } = {}) {\n console.log('address', address);\n if (!this.#provider || chainId)\n this.#provider = new MockProvider({\n ...this.options,\n chainId: chainId ?? this.options.chainId ?? this.chains[0]!.id,\n walletClient: createWalletClient({\n account: address || zeroAddress,\n chain: this.chains.find((chain) => chain.id === chainId) || mainnet,\n transport: http(),\n }),\n });\n return this.#provider;\n }\n\n async getWalletClient(): Promise {\n const provider = await this.getProvider();\n return provider.getWalletClient();\n }\n\n async isAuthorized() {\n try {\n const provider = await this.getProvider();\n const account = await provider.getAccounts();\n return this.options.flags?.isAuthorized ?? !!account;\n } catch {\n return false;\n }\n }\n\n async #switchChain(chainId: number) {\n const provider = await this.getProvider();\n await provider.switchChain(chainId);\n return (\n this.chains.find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${chainId}`,\n network: `${chainId}`,\n nativeCurrency: { name: 'Ether', decimals: 18, symbol: 'ETH' },\n rpcUrls: { default: { http: [''] }, public: { http: [''] } },\n }\n );\n }\n\n async watchAsset(asset: {\n address: string;\n decimals?: number;\n image?: string;\n symbol: string;\n }) {\n const provider = await this.getProvider();\n return provider.watchAsset(asset);\n }\n\n protected onAccountsChanged = (accounts: string[]) => {\n if (accounts.length === 0) this.emit('disconnect');\n else this.emit('change', { account: getAddress(accounts[0] as string) });\n };\n\n protected onChainChanged = (chainId: number | string) => {\n const id = normalizeChainId(chainId);\n const unsupported = this.isChainUnsupported(id);\n this.emit('change', { chain: { id, unsupported } });\n };\n\n protected onDisconnect = () => {\n this.emit('disconnect');\n };\n\n toJSON() {\n return '';\n }\n}\n","import {\n configureChains,\n createConfig,\n GetAccountResult,\n watchAccount,\n watchNetwork,\n} from '@wagmi/core';\nimport React, { useEffect, useState } from 'react';\nimport { Chain } from 'viem';\nimport { publicProvider } from 'wagmi/providers/public';\nimport { StoreApi, UseBoundStore } from 'zustand';\n\nimport {\n AllConnectorsInitProps,\n ConnectorType,\n initAllConnectors,\n} from '../connectors';\n\ninterface WagmiProviderProps {\n useStore: UseBoundStore<\n StoreApi<{\n changeActiveWalletAccount: (account?: GetAccountResult) => Promise;\n changeActiveWalletChain: (chain?: Chain) => Promise;\n setConnectors: (connectors: ConnectorType[]) => void;\n }>\n >;\n connectorsInitProps: AllConnectorsInitProps;\n}\n\nfunction Child({\n useStore,\n connectors,\n}: Omit & {\n connectors: ConnectorType[];\n}) {\n const { setConnectors, changeActiveWalletAccount, changeActiveWalletChain } =\n useStore();\n\n watchAccount(async (data) => {\n if (data.address) {\n await changeActiveWalletAccount(data);\n }\n });\n watchNetwork(async (data) => {\n if (data.chain?.id) {\n await changeActiveWalletChain(data.chain);\n }\n });\n\n useEffect(() => {\n if (connectors) {\n setConnectors(connectors);\n }\n }, [connectors]);\n\n return null;\n}\n\nexport function WagmiProvider({\n useStore,\n connectorsInitProps,\n}: WagmiProviderProps) {\n const [connectors] = useState(initAllConnectors(connectorsInitProps));\n const [mappedConnectors] = useState(\n connectors.map((connector) => connector),\n );\n\n const { publicClient } = configureChains(\n Object.values(connectorsInitProps.chains),\n [publicProvider()],\n );\n\n createConfig({\n autoConnect: false,\n publicClient,\n connectors,\n });\n\n return ;\n}\n","import { Draft, produce } from 'immer';\nimport { Hex, PublicClient } from 'viem';\n\nimport { StoreSlice } from '../../types/store';\nimport {\n getLocalStorageTxPool,\n setLocalStorageTxPool,\n} from '../../utils/localStorage';\nimport { EthereumAdapter } from '../adapters/EthereumAdapter';\nimport {\n GelatoAdapter,\n GelatoTx,\n GelatoTXState,\n isGelatoBaseTx,\n isGelatoBaseTxWithoutTimestamp,\n isGelatoTx,\n} from '../adapters/GelatoAdapter';\nimport { GnosisAdapter } from '../adapters/GnosisAdapter';\nimport { AdapterInterface } from '../adapters/interface';\nimport { WalletType } from '../connectors';\nimport { IWalletSlice } from './walletSlice';\n\nexport type BaseTx = EthBaseTx | GelatoBaseTx;\n\nexport type InitialTx = Hex | GelatoTx;\nexport type NewTx = { hash: Hex } | GelatoTx;\n\ntype BasicTx = {\n chainId: number;\n type: string;\n from: Hex;\n payload?: object;\n localTimestamp: number;\n timestamp?: number;\n errorMessage?: string;\n};\n\nexport type EthBaseTx = BasicTx & {\n hash: Hex;\n to: Hex;\n nonce: number;\n};\n\nexport type GelatoBaseTx = BasicTx & {\n taskId: string;\n hash?: Hex;\n gelatoStatus?: GelatoTXState;\n};\n\nexport type ClientsRecord = Record;\n\nexport type TransactionsSliceBaseType = {\n clients: ClientsRecord;\n setClient: (chainId: number, client: PublicClient) => void;\n initTxPool: () => void;\n updateEthAdapter: (gnosis: boolean) => void;\n};\n\nexport type TransactionPool = Record;\n\ntype PoolTx = T & {\n status?: number;\n pending: boolean;\n walletType: WalletType;\n};\n\nexport interface ITransactionsState {\n transactionsPool: TransactionPool>;\n transactionsIntervalsMap: Record;\n}\n\nexport interface ITransactionsActions {\n gelatoAdapter: AdapterInterface;\n ethereumAdapter: AdapterInterface;\n txStatusChangedCallback: (\n data: T & {\n status?: number;\n timestamp?: number;\n },\n ) => void;\n executeTx: (params: {\n body: () => Promise;\n params: {\n type: T['type'];\n payload: T['payload'];\n desiredChainID: number;\n };\n }) => Promise<\n T & {\n status?: number;\n pending: boolean;\n }\n >;\n addTXToPool: (\n tx:\n | Omit\n | Omit,\n activeWallet: WalletType,\n ) => TransactionPool>;\n isGelatoAvailable: boolean;\n checkIsGelatoAvailable: (chainId: number) => Promise;\n updateEthAdapter: (gnosis: boolean) => void;\n}\n\nexport type ITransactionsSlice = ITransactionsActions &\n ITransactionsState &\n TransactionsSliceBaseType;\n\nexport function createTransactionsSlice({\n txStatusChangedCallback,\n defaultClients,\n}: {\n txStatusChangedCallback: (tx: T) => void;\n defaultClients: ClientsRecord;\n}): StoreSlice<\n ITransactionsSlice,\n Pick\n> {\n return (set, get) => ({\n transactionsPool: {},\n transactionsIntervalsMap: {},\n clients: defaultClients,\n txStatusChangedCallback,\n gelatoAdapter: new GelatoAdapter(get, set), // TODO: think when to init, maybe only when working with gelato or it's available\n ethereumAdapter: new EthereumAdapter(get, set), // This might be a Gnosis Safe adapter, re-inits when wallet.type === GnosisSafe\n executeTx: async ({ body, params }) => {\n await get().checkAndSwitchNetwork(params.desiredChainID);\n const activeWallet = get().activeWallet;\n if (!activeWallet) {\n throw new Error('No wallet connected');\n }\n\n const chainId = Number(params.desiredChainID);\n\n const tx: InitialTx = await body();\n const args = {\n tx: isGelatoTx(tx) ? tx : { hash: tx },\n payload: params.payload,\n activeWallet,\n chainId,\n type: params.type,\n };\n\n return isGelatoTx(tx) // in case of gnosis safe it works in a same way\n ? get().gelatoAdapter.executeTx(args)\n : get().ethereumAdapter.executeTx(args);\n },\n\n addTXToPool: (transaction, walletType) => {\n const localTimestamp = new Date().getTime();\n if (isGelatoBaseTxWithoutTimestamp(transaction)) {\n set((state) =>\n produce(state, (draft) => {\n draft.transactionsPool[transaction.taskId] = {\n ...transaction,\n pending: true,\n walletType,\n localTimestamp,\n } as Draft<\n T & {\n pending: boolean;\n walletType: WalletType;\n localTimestamp: number;\n }\n >;\n }),\n );\n\n const txPool = get().transactionsPool;\n setLocalStorageTxPool(txPool);\n } else {\n set((state) =>\n produce(state, (draft) => {\n draft.transactionsPool[transaction.hash] = {\n ...transaction,\n pending: true,\n walletType,\n localTimestamp,\n } as Draft<\n T & {\n pending: boolean;\n walletType: WalletType;\n }\n >;\n }),\n );\n }\n const txPool = get().transactionsPool;\n setLocalStorageTxPool(txPool);\n return txPool;\n },\n\n initTxPool: () => {\n const localStorageTXPool = getLocalStorageTxPool();\n if (localStorageTXPool) {\n const transactionsPool = JSON.parse(localStorageTXPool);\n // TODO: figure out type casting from string via ZOD or similar\n set(() => ({\n transactionsPool,\n }));\n }\n Object.values(get().transactionsPool).forEach((tx) => {\n if (tx.pending) {\n if (isGelatoBaseTx(tx)) {\n get().gelatoAdapter.startTxTracking(tx.taskId);\n } else {\n if (tx.hash) {\n get().ethereumAdapter.startTxTracking(tx.hash);\n }\n }\n }\n });\n },\n\n setClient: (chainId, client) => {\n const stateClients = get().clients;\n const updatedClients = (stateClients[chainId] = client);\n set({ clients: updatedClients });\n },\n\n isGelatoAvailable: true,\n checkIsGelatoAvailable: async (chainId) => {\n try {\n const response = await fetch(`https://relay.gelato.digital/relays/v2`);\n if (!response.ok) {\n set({ isGelatoAvailable: false });\n } else {\n const listOfRelays = (await response.json()) as { relays: string[] };\n const isRelayAvailable = !!listOfRelays.relays.find(\n (id) => +id === chainId,\n );\n set({ isGelatoAvailable: isRelayAvailable });\n }\n } catch (e) {\n set({ isGelatoAvailable: false });\n console.error(e);\n }\n },\n updateEthAdapter: (gnosis: boolean) => {\n set((state) =>\n produce(state, (draft) => {\n draft.ethereumAdapter = gnosis\n ? new GnosisAdapter(get, set)\n : new EthereumAdapter(get, set);\n }),\n );\n },\n });\n}\n","import { produce } from 'immer';\nimport { GetTransactionReturnType, Hex, PublicClient } from 'viem';\n\nimport { setLocalStorageTxPool } from '../../utils/localStorage';\nimport { BaseTx, ITransactionsSlice, NewTx } from '../store/transactionsSlice';\nimport { Wallet } from '../store/walletSlice';\nimport { AdapterInterface } from './interface';\n\nexport class EthereumAdapter implements AdapterInterface {\n get: () => ITransactionsSlice;\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void;\n transactionsIntervalsMap: Record = {};\n\n constructor(\n get: () => ITransactionsSlice,\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void,\n ) {\n this.get = get;\n this.set = set;\n }\n\n executeTx = async (params: {\n tx: NewTx;\n activeWallet: Wallet;\n payload: object | undefined;\n chainId: number;\n type: T['type'];\n }): Promise => {\n const { activeWallet, chainId, type } = params;\n const tx = params.tx as GetTransactionReturnType;\n\n // ethereum tx\n const transaction = {\n chainId,\n hash: tx.hash,\n type,\n payload: params.payload,\n from: tx.from,\n to: tx.to as Hex,\n nonce: tx.nonce,\n };\n const txPool = this.get().addTXToPool(transaction, activeWallet.walletType);\n this.waitForTxReceipt(tx, tx.hash);\n return txPool[tx.hash];\n };\n startTxTracking = async (txKey: string) => {\n const retryCount = 5;\n const txData = this.get().transactionsPool[txKey];\n if (txData) {\n const client = this.get().clients[txData.chainId] as PublicClient;\n\n if (txData.hash) {\n // Find the transaction in the waiting pool\n for (let i = 0; i < retryCount; i++) {\n const tx = await client.getTransaction({ hash: txData.hash });\n // If the transaction is found, wait for the receipt\n if (tx) {\n await this.waitForTxReceipt(tx, txData.hash);\n return; // Exit the function if successful\n }\n }\n // Wait before the next retry\n await new Promise((resolve) => setTimeout(resolve, 3000));\n }\n } else {\n // TODO: no transaction in waiting pool\n }\n };\n\n private waitForTxReceipt = async (\n tx: GetTransactionReturnType,\n txHash: Hex,\n ) => {\n const chainId = tx.chainId || this.get().transactionsPool[txHash].chainId;\n const client = this.get().clients[chainId] as PublicClient;\n\n try {\n // TODO: need added onReplaced logic\n const txn = await client.waitForTransactionReceipt({ hash: tx.hash });\n this.updateTXStatus(txHash, txn.status);\n\n const updatedTX = this.get().transactionsPool[txHash];\n const txBlock = await client.getBlock({ blockNumber: txn.blockNumber });\n const timestamp = txBlock.timestamp;\n this.get().txStatusChangedCallback({\n ...updatedTX,\n timestamp,\n });\n } catch (e) {\n console.error(e);\n }\n };\n\n private updateTXStatus = (hash: string, status?: 'success' | 'reverted') => {\n this.set((state) =>\n produce(state, (draft) => {\n draft.transactionsPool[hash].status =\n status === 'success'\n ? 1\n : draft.transactionsPool[hash].pending\n ? undefined\n : 0;\n draft.transactionsPool[hash].pending = false;\n }),\n );\n setLocalStorageTxPool(this.get().transactionsPool);\n };\n}\n","import dayjs from 'dayjs';\nimport { produce } from 'immer';\nimport { GetTransactionReturnType, Hex } from 'viem';\n\nimport { SafeTransactionServiceUrls } from '../../utils/constants';\nimport { setLocalStorageTxPool } from '../../utils/localStorage';\nimport {\n BaseTx,\n EthBaseTx,\n ITransactionsSlice,\n NewTx,\n} from '../store/transactionsSlice';\nimport { Wallet } from '../store/walletSlice';\nimport { AdapterInterface } from './interface';\n\nexport type GnosisTxStatusResponse = {\n transactionHash: string;\n safeTxHash: string;\n isExecuted: boolean;\n isSuccessful: boolean | null;\n executionDate: string | null;\n submissionDate: string | null;\n modified: string;\n nonce: number;\n};\n\nexport class GnosisAdapter implements AdapterInterface {\n get: () => ITransactionsSlice;\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void;\n transactionsIntervalsMap: Record = {};\n\n constructor(\n get: () => ITransactionsSlice,\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void,\n ) {\n this.get = get;\n this.set = set;\n }\n\n executeTx = async (params: {\n tx: NewTx;\n activeWallet: Wallet;\n payload: object | undefined;\n chainId: number;\n type: T['type'];\n }): Promise => {\n const { activeWallet, chainId, type } = params;\n const tx = params.tx as GetTransactionReturnType;\n // ethereum tx\n const transaction = {\n chainId,\n hash: tx.hash,\n type,\n payload: params.payload,\n from: tx.from,\n to: tx.to as Hex,\n nonce: tx.nonce,\n };\n const txPool = this.get().addTXToPool(transaction, activeWallet.walletType);\n this.startTxTracking(tx.hash);\n return txPool[tx.hash];\n };\n\n startTxTracking = async (txKey: string) => {\n const tx = this.get().transactionsPool[txKey];\n const isPending = tx.pending;\n if (!isPending) {\n return;\n }\n this.stopPollingGnosisTXStatus(txKey);\n\n const newGnosisInterval = setInterval(() => {\n this.fetchGnosisTxStatus(txKey);\n // TODO: maybe change timeout or even stop tracking after some time (day/week)\n }, 10000);\n\n this.transactionsIntervalsMap[txKey] = Number(newGnosisInterval);\n };\n\n private fetchGnosisTxStatus = async (txKey: string) => {\n const tx = this.get().transactionsPool[txKey];\n const response = await fetch(\n `${\n SafeTransactionServiceUrls[tx.chainId]\n }/multisig-transactions/${txKey}/`,\n );\n if (!response.ok) {\n // TODO: handle error if need, for now just skipping and do nothing with failed response\n } else {\n const gnosisStatus = (await response.json()) as GnosisTxStatusResponse;\n const gnosisStatusModified = dayjs(gnosisStatus.modified);\n const currentTime = dayjs();\n // check if more than a day passed to stop polling\n const daysPassed = currentTime.diff(gnosisStatusModified, 'day');\n if (daysPassed >= 1) {\n this.updateGnosisTxStatus(txKey, gnosisStatus, true);\n this.stopPollingGnosisTXStatus(txKey);\n this.get().txStatusChangedCallback(tx);\n return;\n }\n\n const isPending = !gnosisStatus.isExecuted;\n this.updateGnosisTxStatus(txKey, gnosisStatus);\n if (!isPending) {\n this.stopPollingGnosisTXStatus(txKey);\n this.get().txStatusChangedCallback(tx);\n }\n }\n };\n\n private stopPollingGnosisTXStatus = (txKey: string) => {\n const currentInterval = this.transactionsIntervalsMap[txKey];\n clearInterval(currentInterval);\n this.transactionsIntervalsMap[txKey] = undefined;\n };\n\n private updateGnosisTxStatus = (\n txKey: string,\n statusResponse: GnosisTxStatusResponse,\n forceStopped?: boolean,\n ) => {\n this.set((state) =>\n produce(state, (draft) => {\n const tx = draft.transactionsPool[txKey] as EthBaseTx & {\n pending: boolean;\n status?: number;\n };\n tx.status = forceStopped ? 0 : +!!statusResponse.isSuccessful; // turns boolean | null to 0 or 1\n tx.pending = forceStopped ? false : !statusResponse.isExecuted;\n tx.nonce = statusResponse.nonce;\n }),\n );\n setLocalStorageTxPool(this.get().transactionsPool);\n };\n}\n","// TODO: need add logic for mock connector\n\nimport {\n connect,\n disconnect,\n getAccount,\n GetAccountResult,\n getNetwork,\n getPublicClient,\n getWalletClient,\n} from '@wagmi/core';\nimport { produce } from 'immer';\nimport { Chain, Hex, PublicClient, WalletClient } from 'viem';\n\nimport { StoreSlice } from '../../types/store';\nimport {\n clearWalletConnectV2LocalStorage,\n clearWalletLinkLocalStorage,\n deleteLocalStorageWallet,\n LocalStorageKeys,\n setLocalStorageWallet,\n} from '../../utils/localStorage';\nimport { ConnectorType, getConnectorName, WalletType } from '../connectors';\nimport { ImpersonatedConnector } from '../connectors/ImpersonatedConnector';\nimport { TransactionsSliceBaseType } from './transactionsSlice';\n\nexport interface Wallet {\n walletType: WalletType;\n address: Hex;\n chain?: Chain;\n client: PublicClient;\n walletClient: WalletClient;\n // isActive is added, because Wallet can be connected but not active, i.e. wrong network\n isActive: boolean;\n // isContractAddress is added, to check if wallet address is contract\n isContractAddress: boolean;\n}\n\nexport type IWalletSlice = {\n isContractWalletRecord: Record;\n activeWallet?: Wallet;\n setActiveWallet: (\n wallet: Omit,\n ) => Promise;\n isActiveWalletSetting: boolean;\n connectWallet: (walletType: WalletType) => Promise;\n disconnectActiveWallet: () => Promise;\n walletActivating: boolean;\n walletConnectionError: string;\n resetWalletConnectionError: () => void;\n initDefaultWallet: () => Promise;\n changeActiveWalletAccount: (account?: GetAccountResult) => Promise;\n isActiveWalletAccountChanging: boolean;\n changeActiveWalletChain: (chain?: Chain) => Promise;\n isActiveWalletChainChanging: boolean;\n checkAndSwitchNetwork: (chainId?: number) => Promise;\n connectors: ConnectorType[];\n setConnectors: (connectors: ConnectorType[]) => void;\n _impersonatedAddress?: Hex;\n setImpersonatedAddress: (address: Hex) => void;\n checkIsContractWallet: (\n wallet: Omit,\n ) => Promise;\n};\n\nexport function createWalletSlice({\n walletConnected,\n}: {\n walletConnected: (wallet: Wallet) => void;\n}): StoreSlice {\n return (set, get) => ({\n isContractWalletRecord: {},\n walletActivating: false,\n walletConnectionError: '',\n connectors: [],\n setConnectors: async (connectors) => {\n if (get().connectors.length !== connectors.length) {\n set(() => ({ connectors }));\n await get().initDefaultWallet();\n get().initTxPool();\n }\n },\n initDefaultWallet: async () => {\n const lastConnectedWallet = localStorage.getItem(\n LocalStorageKeys.LastConnectedWallet,\n ) as WalletType | undefined;\n\n if (lastConnectedWallet) {\n await get().connectWallet(lastConnectedWallet);\n }\n },\n\n setActiveWallet: async (wallet) => {\n if (wallet.isActive) {\n if (wallet.chain) {\n set({ isActiveWalletSetting: true });\n const client = getPublicClient({ chainId: wallet.chain.id });\n const walletClient = await getWalletClient({\n chainId: wallet.chain.id,\n });\n\n if (client && walletClient) {\n const walletWithClients = {\n ...wallet,\n walletClient,\n client,\n };\n\n const isContractAddress =\n await get().checkIsContractWallet(walletWithClients);\n const activeWallet = { ...walletWithClients, isContractAddress };\n\n set({ activeWallet });\n walletConnected(activeWallet);\n set({ isActiveWalletSetting: false });\n }\n }\n }\n },\n isActiveWalletSetting: false,\n\n connectWallet: async (walletType) => {\n clearWalletLinkLocalStorage();\n clearWalletConnectV2LocalStorage();\n\n if (get().activeWallet?.walletType !== walletType) {\n await get().disconnectActiveWallet();\n }\n\n set({ walletActivating: true });\n set({ walletConnectionError: '' });\n\n const connector = get().connectors.find(\n (connector) => getConnectorName(connector) === walletType,\n );\n\n try {\n if (connector) {\n if (connector instanceof ImpersonatedConnector) {\n connector.setAccountAddress(get()._impersonatedAddress);\n await connect({ connector });\n } else {\n await connect({ connector });\n }\n\n setLocalStorageWallet(walletType);\n get().updateEthAdapter(walletType === 'GnosisSafe');\n\n const account = getAccount();\n const network = getNetwork();\n if (\n account &&\n account.isConnected &&\n account.address &&\n network.chain\n ) {\n await get().setActiveWallet({\n walletType,\n address: account.address,\n chain: network.chain,\n isActive: account.isConnected,\n isContractAddress: false,\n });\n }\n }\n } catch (e) {\n if (e instanceof Error) {\n let errorMessage = e.message ? e.message.toString() : e.toString();\n set({\n walletConnectionError: errorMessage,\n });\n }\n console.error(e);\n }\n set({ walletActivating: false });\n },\n checkAndSwitchNetwork: async (chainId) => {\n const activeWallet = get().activeWallet;\n if (\n chainId &&\n activeWallet &&\n activeWallet.chain?.id &&\n activeWallet.chain.id !== chainId\n ) {\n set({ isActiveWalletSetting: true });\n await activeWallet.walletClient.switchChain({\n id: chainId,\n });\n await new Promise((resolve) => {\n function loop() {\n if (!get().isActiveWalletSetting) {\n return resolve(() =>\n console.info('Chain for wallet client changed'),\n );\n }\n setTimeout(loop, 10);\n }\n loop();\n });\n }\n },\n disconnectActiveWallet: async () => {\n await disconnect();\n set({ activeWallet: undefined });\n deleteLocalStorageWallet();\n clearWalletLinkLocalStorage();\n clearWalletConnectV2LocalStorage();\n },\n\n checkIsContractWallet: async (wallet) => {\n const address = wallet.address;\n const walletRecord = get().isContractWalletRecord[address];\n if (walletRecord !== undefined) {\n return walletRecord;\n }\n const codeOfWalletAddress = await wallet.client.getBytecode({\n address: wallet.address,\n });\n const isContractWallet = !!codeOfWalletAddress;\n set((state) =>\n produce(state, (draft) => {\n draft.isContractWalletRecord[address] = isContractWallet;\n }),\n );\n return isContractWallet;\n },\n\n changeActiveWalletAccount: async (account) => {\n const activeWallet = get().activeWallet;\n if (\n account &&\n account.address &&\n activeWallet &&\n activeWallet.isActive &&\n activeWallet.address !== account.address &&\n !get().isActiveWalletAccountChanging\n ) {\n set({ isActiveWalletAccountChanging: true });\n await get().setActiveWallet({\n walletType: activeWallet.walletType,\n address: account.address,\n isActive: activeWallet.isActive,\n isContractAddress: activeWallet.isContractAddress,\n chain: activeWallet.chain,\n });\n set({ isActiveWalletAccountChanging: false });\n }\n },\n isActiveWalletAccountChanging: false,\n changeActiveWalletChain: async (chain) => {\n const activeWallet = get().activeWallet;\n if (\n chain !== undefined &&\n activeWallet &&\n activeWallet.isActive &&\n activeWallet.chain &&\n activeWallet.chain.id !== chain.id &&\n !get().isActiveWalletChainChanging\n ) {\n set({ isActiveWalletChainChanging: true });\n await get().setActiveWallet({\n walletType: activeWallet.walletType,\n address: activeWallet.address,\n isActive: activeWallet.isActive,\n isContractAddress: activeWallet.isContractAddress,\n chain: chain,\n });\n set({ isActiveWalletChainChanging: false });\n }\n },\n isActiveWalletChainChanging: false,\n\n setImpersonatedAddress: (address) => {\n set({ _impersonatedAddress: address });\n },\n resetWalletConnectionError: () => {\n set({ walletConnectionError: '' });\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAEA,QAAI,MAAM,OAAO,UAAU;AAA3B,QACI,SAAS;AASb,aAAS,SAAS;AAAA,IAAC;AASnB,QAAI,OAAO,QAAQ;AACjB,aAAO,YAAY,uBAAO,OAAO,IAAI;AAMrC,UAAI,CAAC,IAAI,OAAO,EAAE;AAAW,iBAAS;AAAA,IACxC;AAWA,aAAS,GAAG,IAAI,SAAS,MAAM;AAC7B,WAAK,KAAK;AACV,WAAK,UAAU;AACf,WAAK,OAAO,QAAQ;AAAA,IACtB;AAaA,aAAS,YAAY,SAAS,OAAO,IAAI,SAAS,MAAM;AACtD,UAAI,OAAO,OAAO,YAAY;AAC5B,cAAM,IAAI,UAAU,iCAAiC;AAAA,MACvD;AAEA,UAAI,WAAW,IAAI,GAAG,IAAI,WAAW,SAAS,IAAI,GAC9C,MAAM,SAAS,SAAS,QAAQ;AAEpC,UAAI,CAAC,QAAQ,QAAQ,GAAG;AAAG,gBAAQ,QAAQ,GAAG,IAAI,UAAU,QAAQ;AAAA,eAC3D,CAAC,QAAQ,QAAQ,GAAG,EAAE;AAAI,gBAAQ,QAAQ,GAAG,EAAE,KAAK,QAAQ;AAAA;AAChE,gBAAQ,QAAQ,GAAG,IAAI,CAAC,QAAQ,QAAQ,GAAG,GAAG,QAAQ;AAE3D,aAAO;AAAA,IACT;AASA,aAAS,WAAW,SAAS,KAAK;AAChC,UAAI,EAAE,QAAQ,iBAAiB;AAAG,gBAAQ,UAAU,IAAI,OAAO;AAAA;AAC1D,eAAO,QAAQ,QAAQ,GAAG;AAAA,IACjC;AASA,aAASA,gBAAe;AACtB,WAAK,UAAU,IAAI,OAAO;AAC1B,WAAK,eAAe;AAAA,IACtB;AASA,IAAAA,cAAa,UAAU,aAAa,SAAS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a;AAAA,QACtB,CAAC;AACD,YAAI,EAAE,+BAA+B,MAAM,CAAC;AAAA,MAC9C;AAAA,IACF;AAAA,IACA,+BAA+B;AAAA,IAC/B,yBAAyB,OAAO,UAAU;AACxC,YAAM,eAAe,IAAI,EAAE;AAC3B,UACE,UAAU,UACV,gBACA,aAAa,YACb,aAAa,SACb,aAAa,MAAM,OAAO,MAAM,MAChC,CAAC,IAAI,EAAE,6BACP;AACA,YAAI,EAAE,6BAA6B,KAAK,CAAC;AACzC,cAAM,IAAI,EAAE,gBAAgB;AAAA,UAC1B,YAAY,aAAa;AAAA,UACzB,SAAS,aAAa;AAAA,UACtB,UAAU,aAAa;AAAA,UACvB,mBAAmB,aAAa;AAAA,UAChC;AAAA,QACF,CAAC;AACD,YAAI,EAAE,6BAA6B,MAAM,CAAC;AAAA,MAC5C;AAAA,IACF;AAAA,IACA,6BAA6B;AAAA,IAE7B,wBAAwB,CAAC,YAAY;AACnC,UAAI,EAAE,sBAAsB,QAAQ,CAAC;AAAA,IACvC;AAAA,IACA,4BAA4B,MAAM;AAChC,UAAI,EAAE,uBAAuB,GAAG,CAAC;AAAA,IACnC;AAAA,EACF;AACF;","names":["EventEmitter","LocalStorageKeys","goerli","mainnet","avalanche","goerli","mainnet","polygon","InjectedConnector","goerli","mainnet","EventEmitter","mainnet","goerli","import_eventemitter3","EventEmitter","UserRejectedRequestError","getAddress","_provider","provider","__accessCheck","__privateGet","__privateAdd","__privateSet","__privateMethod","createPublicClient","http","getAddress","getAddress2","createPublicClient","http","__privateAdd","status","__privateSet","__privateMethod","__privateGet","status","status","createWalletClient","getAddress","http","mainnet","normalizeChainId","InjectedConnector","coinbase","useEffect","useState","useEffect","useState","produce","produce","status","produce","produce","produce","produce","txPool","produce","connector","produce"]} \ No newline at end of file +{"version":3,"sources":["../node_modules/eventemitter3/index.js","../src/hooks/useLastTxLocalStatus.tsx","../src/web3/adapters/GelatoAdapter.ts","../src/utils/localStorage.ts","../src/web3/store/transactionsSelectors.ts","../src/utils/chainInfoHelpers.ts","../src/utils/constants.ts","../src/utils/wallets/wallets/alphawallet.ts","../src/utils/wallets/wallets/atoken.ts","../src/utils/wallets/wallets/binance.ts","../src/utils/wallets/wallets/bitkeep.ts","../src/utils/wallets/wallets/bitpie.ts","../src/utils/wallets/wallets/bitski.ts","../src/utils/wallets/wallets/blockwallet.ts","../src/utils/wallets/wallets/brave.ts","../src/utils/wallets/wallets/coinbase.ts","../src/utils/wallets/wallets/core.ts","../src/utils/wallets/wallets/dcent.ts","../src/utils/wallets/wallets/defiwallet.ts","../src/utils/wallets/wallets/enkrypt.ts","../src/utils/wallets/wallets/exodus.ts","../src/utils/wallets/wallets/frame.ts","../src/utils/wallets/wallets/frontier.ts","../src/utils/wallets/wallets/gamestop.ts","../src/utils/wallets/wallets/huobiwallet.ts","../src/utils/wallets/wallets/hyperpay.ts","../src/utils/wallets/wallets/imtoken.ts","../src/utils/wallets/wallets/liquality.ts","../src/utils/wallets/wallets/mathwallet.ts","../src/utils/wallets/wallets/meetone.ts","../src/utils/wallets/wallets/metamask.ts","../src/utils/wallets/wallets/mykey.ts","../src/utils/wallets/wallets/okxwallet.ts","../src/utils/wallets/wallets/oneInch.ts","../src/utils/wallets/wallets/opera.ts","../src/utils/wallets/wallets/ownbit.ts","../src/utils/wallets/wallets/phantom.ts","../src/utils/wallets/wallets/rabby.ts","../src/utils/wallets/wallets/rainbow.ts","../src/utils/wallets/wallets/safepal.ts","../src/utils/wallets/wallets/sequence.ts","../src/utils/wallets/wallets/status.ts","../src/utils/wallets/wallets/tallywallet.ts","../src/utils/wallets/wallets/tokenary.ts","../src/utils/wallets/wallets/tokenpocket.ts","../src/utils/wallets/wallets/tp.ts","../src/utils/wallets/wallets/trust.ts","../src/utils/wallets/wallets/walletio.ts","../src/utils/wallets/wallets/xdefi.ts","../src/utils/wallets/wallets/zeal.ts","../src/utils/wallets/wallets/zerion.ts","../src/utils/wallets/wallets.ts","../src/utils/wallets/wallets/defaultWallet.ts","../src/utils/wallets/getBrowserWalletLabelAndIcon.ts","../src/web3/connectors/index.ts","../node_modules/@wagmi/connectors/dist/chunk-OQILYQDO.js","../node_modules/@wagmi/connectors/dist/chunk-W65LBPLT.js","../node_modules/@wagmi/connectors/dist/mock/index.js","../node_modules/@wagmi/connectors/dist/chunk-UGBGYVBH.js","../node_modules/@wagmi/connectors/dist/chunk-2UFLHRLT.js","../node_modules/@wagmi/core/dist/chunk-MQXBDTVK.js","../node_modules/@wagmi/core/dist/chunk-TSH6VVF4.js","../src/web3/connectors/ImpersonatedConnector.ts","../src/web3/providers/WagmiProvider.tsx","../src/web3/store/transactionsSlice.ts","../src/web3/adapters/EthereumAdapter.ts","../src/web3/adapters/GnosisAdapter.ts","../src/web3/store/walletSlice.ts"],"sourcesContent":["'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 { useEffect, useState } from 'react';\n\nimport { isGelatoBaseTx } from '../web3/adapters/GelatoAdapter';\nimport { selectLastTxByTypeAndPayload } from '../web3/store/transactionsSelectors';\nimport { BaseTx, ITransactionsState } from '../web3/store/transactionsSlice';\n\ninterface LastTxStatusesParams {\n state: ITransactionsState;\n activeAddress: string;\n type: T['type'];\n payload: T['payload'];\n}\n\ntype ExecuteTxWithLocalStatusesParams = {\n errorMessage: string;\n callbackFunction: () => Promise;\n};\n\nexport const useLastTxLocalStatus = ({\n state,\n activeAddress,\n type,\n payload,\n}: LastTxStatusesParams) => {\n const tx = selectLastTxByTypeAndPayload(state, activeAddress, type, payload);\n\n const [fullTxErrorMessage, setFullTxErrorMessage] = useState(\n '',\n );\n const [error, setError] = useState('');\n const [loading, setLoading] = useState(false);\n const [isTxStart, setIsTxStart] = useState(false);\n\n const txHash = tx && tx.hash;\n const txPending = tx && tx.pending;\n const isError =\n tx && isGelatoBaseTx(tx)\n ? !tx.pending && (tx.status !== 1 || !!error)\n : (tx && !tx.pending && tx.status !== 1) || !!error;\n const txSuccess = tx && tx.status === 1 && !isError;\n const txChainId = tx && tx.chainId;\n const txWalletType = tx && tx.walletType;\n\n useEffect(() => {\n return () => {\n setFullTxErrorMessage('');\n setError('');\n };\n }, []);\n\n useEffect(() => {\n if (txPending || isError) {\n setIsTxStart(true);\n }\n }, [txPending, isError]);\n\n useEffect(() => {\n if (tx?.errorMessage) {\n setError(tx.errorMessage);\n }\n }, [tx?.errorMessage]);\n\n async function executeTxWithLocalStatuses({\n errorMessage,\n callbackFunction,\n }: ExecuteTxWithLocalStatusesParams) {\n setError('');\n setLoading(true);\n try {\n await callbackFunction();\n } catch (e) {\n if (e instanceof Error) {\n console.error('TX error: ', e);\n setFullTxErrorMessage(!!e?.message ? e.message : e);\n setError(errorMessage);\n }\n }\n setLoading(false);\n }\n\n return {\n error,\n setError,\n loading,\n setLoading,\n isTxStart,\n setIsTxStart,\n txHash,\n txPending,\n txSuccess,\n txChainId,\n txWalletType,\n isError,\n executeTxWithLocalStatuses,\n fullTxErrorMessage,\n setFullTxErrorMessage,\n };\n};\n","import { produce } from 'immer';\nimport { Hex } from 'viem';\n\nimport { setLocalStorageTxPool } from '../../utils/localStorage';\nimport { selectIsGelatoTXPending } from '../store/transactionsSelectors';\nimport {\n BaseTx,\n GelatoBaseTx,\n InitialTx,\n ITransactionsSlice,\n NewTx,\n} from '../store/transactionsSlice';\nimport { Wallet } from '../store/walletSlice';\nimport { AdapterInterface } from './interface';\n\nexport type GelatoTXState =\n | 'WaitingForConfirmation'\n | 'CheckPending'\n | 'ExecSuccess'\n | 'Cancelled'\n | 'ExecPending'\n | 'ExecReverted';\n\nexport type GelatoTaskStatusResponse = {\n task: {\n chainId: number;\n taskId: string;\n taskState: GelatoTXState;\n creationDate?: string;\n executionDate?: string;\n transactionHash?: Hex;\n blockNumber?: number;\n lastCheckMessage?: string;\n };\n};\n\nexport type GelatoTx = {\n taskId: string;\n};\n\nexport function isGelatoTx(tx: InitialTx): tx is GelatoTx {\n return (tx as GelatoTx).taskId !== undefined;\n}\n\nexport function isGelatoBaseTx(tx: BaseTx): tx is GelatoBaseTx {\n return (tx as GelatoBaseTx).taskId !== undefined;\n}\n\nexport function isGelatoBaseTxWithoutTimestamp(\n tx: Omit,\n): tx is Omit {\n return (tx as GelatoBaseTx).taskId !== undefined;\n}\n\nexport class GelatoAdapter implements AdapterInterface {\n get: () => ITransactionsSlice;\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void;\n transactionsIntervalsMap: Record = {};\n\n constructor(\n get: () => ITransactionsSlice,\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void,\n ) {\n this.get = get;\n this.set = set;\n }\n\n executeTx = async (params: {\n tx: NewTx;\n activeWallet: Wallet;\n payload: object | undefined;\n chainId: number;\n type: T['type'];\n }): Promise => {\n const { activeWallet, chainId, type } = params;\n const tx = params.tx as GelatoTx;\n const from = activeWallet.address;\n const gelatoTX = {\n from: from as Hex,\n chainId,\n type: type,\n taskId: tx.taskId,\n payload: params.payload,\n };\n\n const txPool = this.get().addTXToPool(gelatoTX, activeWallet.walletType);\n this.startTxTracking(tx.taskId);\n\n return txPool[tx.taskId];\n };\n\n startTxTracking = async (taskId: string) => {\n const tx = this.get().transactionsPool[taskId] as GelatoBaseTx;\n\n const isPending = selectIsGelatoTXPending(tx.gelatoStatus);\n if (!isPending) {\n return;\n }\n\n this.stopPollingGelatoTXStatus(taskId);\n\n const newGelatoInterval = setInterval(() => {\n this.fetchGelatoTXStatus(taskId);\n // TODO: maybe change timeout for gelato\n }, 2000);\n\n this.transactionsIntervalsMap[taskId] = Number(newGelatoInterval);\n };\n\n private stopPollingGelatoTXStatus = (taskId: string) => {\n const currentInterval = this.transactionsIntervalsMap[taskId];\n clearInterval(currentInterval);\n this.transactionsIntervalsMap[taskId] = undefined;\n };\n\n private fetchGelatoTXStatus = async (taskId: string) => {\n const response = await fetch(\n `https://api.gelato.digital/tasks/status/${taskId}/`,\n );\n if (!response.ok) {\n // TODO: handle error if needed, for now just skipping\n } else {\n const gelatoStatus = (await response.json()) as GelatoTaskStatusResponse;\n\n const isPending = selectIsGelatoTXPending(gelatoStatus.task.taskState);\n this.updateGelatoTX(taskId, gelatoStatus);\n if (!isPending) {\n this.stopPollingGelatoTXStatus(taskId);\n const tx = this.get().transactionsPool[taskId];\n this.get().txStatusChangedCallback(tx);\n }\n }\n };\n\n private updateGelatoTX = (\n taskId: string,\n statusResponse: GelatoTaskStatusResponse,\n ) => {\n this.set((state) =>\n produce(state, (draft) => {\n const tx = draft.transactionsPool[taskId] as GelatoBaseTx & {\n pending: boolean;\n status?: number;\n };\n tx.gelatoStatus = statusResponse.task.taskState;\n tx.pending = selectIsGelatoTXPending(statusResponse.task.taskState);\n tx.hash = statusResponse.task.transactionHash;\n tx.status =\n statusResponse.task.taskState === 'ExecSuccess'\n ? 1\n : tx.pending\n ? undefined\n : 0;\n if (statusResponse.task.executionDate) {\n tx.timestamp = new Date(statusResponse.task.executionDate).getTime();\n }\n if (statusResponse.task.lastCheckMessage) {\n tx.errorMessage = statusResponse.task.lastCheckMessage;\n }\n }),\n );\n setLocalStorageTxPool(this.get().transactionsPool);\n };\n}\n","import { WalletType } from '../web3/connectors';\nimport { BaseTx, TransactionPool } from '../web3/store/transactionsSlice';\n\nexport enum LocalStorageKeys {\n LastConnectedWallet = 'LastConnectedWallet',\n TransactionPool = 'TransactionPool',\n}\n\nexport const setLocalStorageTxPool = (\n pool: TransactionPool,\n) => {\n const stringifiedPool = JSON.stringify(pool);\n localStorage.setItem(LocalStorageKeys.TransactionPool, stringifiedPool);\n};\n\nexport const getLocalStorageTxPool = () => {\n return localStorage.getItem(LocalStorageKeys.TransactionPool);\n};\n\nexport const setLocalStorageWallet = (walletType: WalletType) => {\n localStorage.setItem(LocalStorageKeys.LastConnectedWallet, walletType);\n};\n\nexport const deleteLocalStorageWallet = () => {\n localStorage.removeItem(LocalStorageKeys.LastConnectedWallet);\n localStorage.removeItem('wagmi.wallet');\n};\n\nexport const clearWalletLinkLocalStorage = () => {\n localStorage.removeItem('walletconnect');\n localStorage.removeItem('-walletlink:https://www.walletlink.org:version');\n localStorage.removeItem('-walletlink:https://www.walletlink.org:session:id');\n localStorage.removeItem(\n '-walletlink:https://www.walletlink.org:session:secret',\n );\n localStorage.removeItem(\n '-walletlink:https://www.walletlink.org:session:linked',\n );\n localStorage.removeItem('-walletlink:https://www.walletlink.org:AppVersion');\n localStorage.removeItem('-walletlink:https://www.walletlink.org:Addresses');\n localStorage.removeItem(\n '-walletlink:https://www.walletlink.org:walletUsername',\n );\n};\n\nexport const clearWalletConnectV2LocalStorage = () => {\n localStorage.removeItem('wc@2:core:0.3//messages');\n localStorage.removeItem('wc@2:client:0.3//proposal');\n localStorage.removeItem('wc@2:universal_provider:/namespaces');\n localStorage.removeItem('wc@2:core:0.3//subscription');\n localStorage.removeItem('wc@2:core:0.3//history');\n localStorage.removeItem('wc@2:core:0.3//expirer');\n localStorage.removeItem('wc@2:core:0.3//pairing');\n localStorage.removeItem('wc@2:universal_provider:/optionalNamespaces');\n};\n","import isEqual from 'lodash/isEqual.js';\nimport { Chain } from 'viem';\nimport { goerli, mainnet } from 'viem/chains';\n\nimport { isGelatoBaseTx } from '../adapters/GelatoAdapter';\nimport { BaseTx, GelatoBaseTx, ITransactionsState } from './transactionsSlice';\n\nexport const selectAllTransactions = (\n state: ITransactionsState,\n) => {\n return Object.values(state.transactionsPool).sort(\n (a, b) => Number(a.localTimestamp) - Number(b.localTimestamp),\n );\n};\n\nexport const selectPendingTransactions = (\n state: ITransactionsState,\n) => {\n return selectAllTransactions(state).filter((tx) => tx.pending);\n};\n\nexport const selectTXByKey = (\n state: ITransactionsState,\n key: string,\n) => {\n return state.transactionsPool[key];\n};\n\nexport const selectTXByHash = (\n state: ITransactionsState,\n hash: string,\n) => {\n const txByKey = selectTXByKey(state, hash);\n if (txByKey) {\n return txByKey;\n }\n return selectAllTransactions(state).find((tx) => tx.hash === hash);\n};\n\nexport const selectAllTransactionsByWallet = (\n state: ITransactionsState,\n from: string,\n) => {\n return selectAllTransactions(state).filter((tx) => tx.from === from);\n};\n\nexport const selectPendingTransactionByWallet = (\n state: ITransactionsState,\n from: string,\n) => {\n return selectPendingTransactions(state).filter((tx) => tx.from === from);\n};\n\nexport const selectLastTxByTypeAndPayload = (\n state: ITransactionsState,\n from: string,\n type: T['type'],\n payload: T['payload'],\n) => {\n const allTransactions = selectAllTransactionsByWallet(state, from);\n const filteredTransactions = allTransactions.filter(\n (tx) => tx.type === type && isEqual(tx.payload, payload),\n );\n const lastFilteredTransaction =\n filteredTransactions[filteredTransactions.length - 1];\n\n if (lastFilteredTransaction) {\n if (isGelatoBaseTx(lastFilteredTransaction)) {\n return selectTXByKey(state, lastFilteredTransaction.taskId);\n } else {\n if (lastFilteredTransaction.hash) {\n return selectTXByKey(state, lastFilteredTransaction.hash);\n } else {\n return undefined;\n }\n }\n } else {\n return undefined;\n }\n};\n\nexport const selectTxExplorerLink = (\n state: ITransactionsState,\n getChainParameters: (chainId: number) => Chain,\n txHash: string,\n) => {\n const tx = selectTXByHash(state, txHash);\n if (!tx) {\n return '';\n }\n\n // TODO: need check\n const gnosisSafeLinksHelper: Record = {\n [mainnet.id]: 'https://app.safe.global/eth:',\n [goerli.id]: 'https://app.safe.global/gor:',\n };\n\n if (tx.walletType !== 'GnosisSafe') {\n return `${getChainParameters(tx.chainId).blockExplorers}/tx/${txHash}`;\n } else {\n return `${gnosisSafeLinksHelper[tx.chainId]}${\n tx.from\n }/transactions/tx?id=multisig_${tx.from}_${txHash}`;\n }\n};\n\nexport const selectIsGelatoTXPending = (\n gelatoStatus?: GelatoBaseTx['gelatoStatus'],\n) => {\n return (\n gelatoStatus === undefined ||\n gelatoStatus === 'CheckPending' ||\n gelatoStatus === 'WaitingForConfirmation' ||\n gelatoStatus === 'ExecPending'\n );\n};\n","import { Chain, createPublicClient, http, PublicClient } from 'viem';\nimport {\n avalanche,\n avalancheFuji,\n goerli,\n mainnet,\n polygon,\n polygonMumbai,\n sepolia,\n} from 'viem/chains';\n\nexport const initialChains: Record = {\n [mainnet.id]: mainnet,\n [polygon.id]: polygon,\n [polygonMumbai.id]: polygonMumbai,\n [avalanche.id]: avalanche,\n [avalancheFuji.id]: avalancheFuji,\n [goerli.id]: goerli,\n [sepolia.id]: sepolia,\n};\n\nexport const initChainInformationConfig = (chains?: Record) => {\n const CHAINS = { ...initialChains, ...chains } || {};\n\n // init clients instances from chain config\n const initalizedClients: Record = {};\n const clientInstances = Object.values(CHAINS).reduce<{\n [chainId: number]: {\n instance: PublicClient;\n };\n }>((accumulator, chain) => {\n const numberChainId = Number(chain.id);\n accumulator[numberChainId] = {\n get instance() {\n if (initalizedClients[numberChainId]) {\n return initalizedClients[numberChainId];\n } else {\n const client = createPublicClient({\n batch: {\n multicall: true,\n },\n chain,\n transport: http(),\n }) as PublicClient;\n initalizedClients[numberChainId] = client;\n return client;\n }\n },\n } as {\n instance: PublicClient;\n };\n return accumulator;\n }, {});\n\n function getChainParameters(chainId: number): Chain {\n const chainInformation = CHAINS[chainId];\n if (chainInformation) {\n return chainInformation;\n } else {\n // this case can only ever occure when a wallet is connected with an unknown chainId which will not allow interaction\n return {\n ...mainnet,\n id: chainId,\n name: `unknown network: ${chainId}`,\n };\n }\n }\n\n return {\n clientInstances,\n getChainParameters,\n };\n};\n","import {\n arbitrum,\n avalanche,\n goerli,\n mainnet,\n optimism,\n polygon,\n} from 'viem/chains';\n\nexport const SafeTransactionServiceUrls: { [key in number]: string } = {\n [mainnet.id]: 'https://safe-transaction-mainnet.safe.global/api/v1',\n [goerli.id]: 'https://safe-transaction-goerli.safe.global/api/v1',\n [optimism.id]: 'https://safe-transaction-optimism.safe.global/api/v1',\n [polygon.id]: 'https://safe-transaction-polygon.safe.global/api/v1',\n [arbitrum.id]: 'https://safe-transaction-arbitrum.safe.global/api/v1',\n [avalanche.id]: 'https://safe-transaction-avalanche.safe.global/api/v1',\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const alphawallet = {\n identityFlag: WalletIdentityFlag.AlphaWallet,\n label: WalletLabel.AlphaWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const atoken = {\n identityFlag: WalletIdentityFlag.AToken,\n label: WalletLabel.AToken,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const binance = {\n identityFlag: WalletIdentityFlag.Binance,\n label: WalletLabel.Binance,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const bitkeep = {\n identityFlag: WalletIdentityFlag.BitKeep,\n label: WalletLabel.BitKeep,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const bitpie = {\n identityFlag: WalletIdentityFlag.Bitpie,\n label: WalletLabel.Bitpie,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const bitski = {\n identityFlag: WalletIdentityFlag.Bitski,\n label: WalletLabel.Bitski,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const blockwallet = {\n identityFlag: WalletIdentityFlag.BlockWallet,\n label: WalletLabel.BlockWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const brave = {\n identityFlag: WalletIdentityFlag.BraveWallet,\n label: WalletLabel.Brave,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const coinbase = {\n identityFlag: WalletIdentityFlag.Coinbase,\n label: WalletLabel.Coinbase,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const core = {\n identityFlag: WalletIdentityFlag.Core,\n label: WalletLabel.Core,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const dcent = {\n identityFlag: WalletIdentityFlag.Dcent,\n label: WalletLabel.Dcent,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const defiwallet = {\n identityFlag: WalletIdentityFlag.DeFiWallet,\n label: WalletLabel.DeFiWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const enkrypt = {\n identityFlag: WalletIdentityFlag.Enkrypt,\n label: WalletLabel.Enkrypt,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const exodus = {\n identityFlag: WalletIdentityFlag.Exodus,\n label: WalletLabel.Exodus,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const frame = {\n identityFlag: WalletIdentityFlag.Frame,\n label: WalletLabel.Frame,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const frontier = {\n identityFlag: WalletIdentityFlag.Frontier,\n label: WalletLabel.Frontier,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const gamestop = {\n identityFlag: WalletIdentityFlag.GameStop,\n label: WalletLabel.GameStop,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const huobiwallet = {\n identityFlag: WalletIdentityFlag.HuobiWallet,\n label: WalletLabel.HuobiWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const hyperpay = {\n identityFlag: WalletIdentityFlag.HyperPay,\n label: WalletLabel.HyperPay,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const imtoken = {\n identityFlag: WalletIdentityFlag.ImToken,\n label: WalletLabel.ImToken,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const liquality = {\n identityFlag: WalletIdentityFlag.Liquality,\n label: WalletLabel.Liquality,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const mathwallet = {\n identityFlag: WalletIdentityFlag.MathWallet,\n label: WalletLabel.MathWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const meetone = {\n identityFlag: WalletIdentityFlag.MeetOne,\n label: WalletLabel.MeetOne,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const metamask = {\n identityFlag: WalletIdentityFlag.MetaMask,\n label: WalletLabel.MetaMask,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const mykey = {\n identityFlag: WalletIdentityFlag.MyKey,\n label: WalletLabel.MyKey,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const okxwallet = {\n identityFlag: WalletIdentityFlag.OKXWallet,\n label: WalletLabel.OKXWallet,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const oneInch = {\n identityFlag: WalletIdentityFlag.OneInch,\n label: WalletLabel.OneInch,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const opera = {\n identityFlag: WalletIdentityFlag.Opera,\n label: WalletLabel.Opera,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const ownbit = {\n identityFlag: WalletIdentityFlag.OwnBit,\n label: WalletLabel.OwnBit,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const phantom = {\n identityFlag: WalletIdentityFlag.Phantom,\n label: WalletLabel.Phantom,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const rabby = {\n identityFlag: WalletIdentityFlag.Rabby,\n label: WalletLabel.Rabby,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const rainbow = {\n identityFlag: WalletIdentityFlag.Rainbow,\n label: WalletLabel.Rainbow,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const safepal = {\n identityFlag: WalletIdentityFlag.SafePal,\n label: WalletLabel.SafePal,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const sequence = {\n identityFlag: WalletIdentityFlag.Sequence,\n label: WalletLabel.Sequence,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const status = {\n identityFlag: WalletIdentityFlag.Status,\n label: WalletLabel.Status,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tallywallet = {\n identityFlag: WalletIdentityFlag.Tally,\n label: WalletLabel.Tally,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tokenary = {\n identityFlag: WalletIdentityFlag.Tokenary,\n label: WalletLabel.Tokenary,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tokenpocket = {\n identityFlag: WalletIdentityFlag.TokenPocket,\n label: WalletLabel.TokenPocket,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const tp = {\n identityFlag: WalletIdentityFlag.TP,\n label: WalletLabel.TP,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const trust = {\n identityFlag: WalletIdentityFlag.Trust,\n label: WalletLabel.Trust,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const walletio = {\n identityFlag: WalletIdentityFlag.WalletIo,\n label: WalletLabel.WalletIo,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const xdefi = {\n identityFlag: WalletIdentityFlag.XDEFI,\n label: WalletLabel.XDEFI,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const zeal = {\n identityFlag: WalletIdentityFlag.Zeal,\n label: WalletLabel.Zeal,\n icon: ``,\n};\n","import { WalletIdentityFlag, WalletLabel } from '../types';\n\nexport const zerion = {\n identityFlag: WalletIdentityFlag.Zerion,\n label: WalletLabel.Zerion,\n icon: ``,\n};\n","import { alphawallet } from './wallets/alphawallet';\nimport { atoken } from './wallets/atoken';\nimport { binance } from './wallets/binance';\nimport { bitkeep } from './wallets/bitkeep';\nimport { bitpie } from './wallets/bitpie';\nimport { bitski } from './wallets/bitski';\nimport { blockwallet } from './wallets/blockwallet';\nimport { brave } from './wallets/brave';\nimport { coinbase } from './wallets/coinbase';\nimport { core } from './wallets/core';\nimport { dcent } from './wallets/dcent';\nimport { defiwallet } from './wallets/defiwallet';\nimport { enkrypt } from './wallets/enkrypt';\nimport { exodus } from './wallets/exodus';\nimport { frame } from './wallets/frame';\nimport { frontier } from './wallets/frontier';\nimport { gamestop } from './wallets/gamestop';\nimport { huobiwallet } from './wallets/huobiwallet';\nimport { hyperpay } from './wallets/hyperpay';\nimport { imtoken } from './wallets/imtoken';\nimport { liquality } from './wallets/liquality';\nimport { mathwallet } from './wallets/mathwallet';\nimport { meetone } from './wallets/meetone';\nimport { metamask } from './wallets/metamask';\nimport { mykey } from './wallets/mykey';\nimport { okxwallet } from './wallets/okxwallet';\nimport { oneInch } from './wallets/oneInch';\nimport { opera } from './wallets/opera';\nimport { ownbit } from './wallets/ownbit';\nimport { phantom } from './wallets/phantom';\nimport { rabby } from './wallets/rabby';\nimport { rainbow } from './wallets/rainbow';\nimport { safepal } from './wallets/safepal';\nimport { sequence } from './wallets/sequence';\nimport { status } from './wallets/status';\nimport { tallywallet } from './wallets/tallywallet';\nimport { tokenary } from './wallets/tokenary';\nimport { tokenpocket } from './wallets/tokenpocket';\nimport { tp } from './wallets/tp';\nimport { trust } from './wallets/trust';\nimport { walletio } from './wallets/walletio';\nimport { xdefi } from './wallets/xdefi';\nimport { zeal } from './wallets/zeal';\nimport { zerion } from './wallets/zerion';\n\nexport const wallets = [\n alphawallet,\n atoken,\n binance,\n bitkeep,\n bitpie,\n bitski,\n blockwallet,\n brave,\n coinbase,\n core,\n dcent,\n defiwallet,\n enkrypt,\n exodus,\n frame,\n frontier,\n gamestop,\n huobiwallet,\n hyperpay,\n imtoken,\n liquality,\n mathwallet,\n meetone,\n metamask,\n mykey,\n okxwallet,\n oneInch,\n opera,\n ownbit,\n phantom,\n rabby,\n rainbow,\n safepal,\n sequence,\n status,\n tallywallet,\n tokenary,\n tokenpocket,\n tp,\n trust,\n walletio,\n xdefi,\n zeal,\n zerion,\n];\n","export const defaultWallet = {\n label: 'Browser wallet',\n icon: ``,\n};\n","import { wallets } from './wallets';\nimport { defaultWallet } from './wallets/defaultWallet';\n\nexport function getBrowserWalletLabelAndIcon() {\n const defaultBrowserWallet = {\n label: defaultWallet.label,\n icon: defaultWallet.icon,\n };\n\n if (typeof window !== 'undefined') {\n if (!!window.ethereum) {\n const userBrowserWallets = wallets.filter(\n (wallet) => !!window.ethereum[wallet.identityFlag],\n );\n if (userBrowserWallets.length > 1 || userBrowserWallets.length === 0) {\n return defaultBrowserWallet;\n } else {\n return {\n label: userBrowserWallets[0].label,\n icon: userBrowserWallets[0].icon,\n };\n }\n } else {\n return defaultBrowserWallet;\n }\n } else {\n return defaultBrowserWallet;\n }\n}\n","import { Chain } from 'viem';\nimport { CoinbaseWalletConnector } from 'wagmi/connectors/coinbaseWallet';\nimport { InjectedConnector } from 'wagmi/connectors/injected';\nimport { SafeConnector } from 'wagmi/connectors/safe';\nimport { WalletConnectConnector } from 'wagmi/connectors/walletConnect';\n\nimport { ImpersonatedConnector } from './ImpersonatedConnector';\n\nexport type ConnectorType =\n | InjectedConnector\n | WalletConnectConnector\n | CoinbaseWalletConnector\n | SafeConnector\n | ImpersonatedConnector;\n\nexport type AllConnectorsInitProps = {\n appName: string;\n chains: Record;\n defaultChainId?: number;\n wcParams?: {\n projectId: string;\n metadata: {\n name: string;\n description: string;\n url: string;\n icons: string[];\n };\n };\n};\n\nexport const initAllConnectors = (props: AllConnectorsInitProps) => {\n const chains = Object.values(props.chains);\n const chainIds = Object.keys(props.chains).map(Number);\n\n const wcParams = props.wcParams;\n let walletConnect: WalletConnectConnector | null = null;\n if (wcParams) {\n walletConnect = new WalletConnectConnector({\n chains,\n options: {\n ...wcParams,\n },\n });\n }\n\n const injected = new InjectedConnector({\n chains,\n options: {\n name: (detectedName) =>\n `${\n typeof detectedName === 'string'\n ? detectedName\n : detectedName.join(', ')\n }`,\n },\n });\n const coinbase = new CoinbaseWalletConnector({\n chains,\n options: {\n appName: props.appName,\n jsonRpcUrl:\n props.chains[props.defaultChainId || chainIds[0]].rpcUrls.default\n .http[0],\n },\n });\n const gnosisSafe = new SafeConnector({\n chains,\n options: {\n allowedDomains: [/gnosis-safe.io$/, /app.safe.global$/],\n debug: false,\n },\n });\n\n const impersonated = new ImpersonatedConnector({\n chains,\n options: {\n chainId: props.chains[props.defaultChainId || chainIds[0]].id,\n },\n });\n\n const connectors: ConnectorType[] = [\n injected,\n coinbase,\n gnosisSafe,\n impersonated,\n ];\n if (walletConnect !== null) {\n connectors.push(walletConnect);\n }\n\n return connectors;\n};\n\nexport type WalletType =\n | 'Injected'\n | 'WalletConnect'\n | 'Coinbase'\n | 'GnosisSafe'\n | 'Impersonated';\n\nexport function getConnectorName(\n connector: ConnectorType,\n): WalletType | undefined {\n if (connector instanceof InjectedConnector) return 'Injected';\n if (connector instanceof WalletConnectConnector) return 'WalletConnect';\n if (connector instanceof CoinbaseWalletConnector) return 'Coinbase';\n if (connector instanceof SafeConnector) return 'GnosisSafe';\n if (connector instanceof ImpersonatedConnector) return 'Impersonated';\n return;\n}\n","// src/utils/normalizeChainId.ts\nfunction normalizeChainId(chainId) {\n if (typeof chainId === \"string\")\n return Number.parseInt(\n chainId,\n chainId.trim().substring(0, 2) === \"0x\" ? 16 : 10\n );\n if (typeof chainId === \"bigint\")\n return Number(chainId);\n return chainId;\n}\n\nexport {\n normalizeChainId\n};\n","var __accessCheck = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n};\nvar __privateGet = (obj, member, getter) => {\n __accessCheck(obj, member, \"read from private field\");\n return getter ? getter.call(obj) : member.get(obj);\n};\nvar __privateAdd = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n};\nvar __privateSet = (obj, member, value, setter) => {\n __accessCheck(obj, member, \"write to private field\");\n setter ? setter.call(obj, value) : member.set(obj, value);\n return value;\n};\nvar __privateMethod = (obj, member, method) => {\n __accessCheck(obj, member, \"access private method\");\n return method;\n};\n\n// src/base.ts\nimport { default as EventEmitter } from \"eventemitter3\";\nimport { goerli, mainnet } from \"viem/chains\";\nvar Connector = class extends EventEmitter {\n constructor({\n chains = [mainnet, goerli],\n options\n }) {\n super();\n this.chains = chains;\n this.options = options;\n }\n getBlockExplorerUrls(chain) {\n const { default: blockExplorer, ...blockExplorers } = chain.blockExplorers ?? {};\n if (blockExplorer)\n return [\n blockExplorer.url,\n ...Object.values(blockExplorers).map((x) => x.url)\n ];\n }\n isChainUnsupported(chainId) {\n return !this.chains.some((x) => x.id === chainId);\n }\n setStorage(storage) {\n this.storage = storage;\n }\n};\n\nexport {\n __privateGet,\n __privateAdd,\n __privateSet,\n __privateMethod,\n Connector\n};\n","import {\n normalizeChainId\n} from \"../chunk-OQILYQDO.js\";\nimport {\n Connector,\n __privateAdd,\n __privateGet,\n __privateMethod,\n __privateSet\n} from \"../chunk-W65LBPLT.js\";\n\n// src/mock/connector.ts\nimport { getAddress as getAddress2 } from \"viem\";\n\n// src/mock/provider.ts\nimport { default as EventEmitter } from \"eventemitter3\";\nimport { UserRejectedRequestError, getAddress } from \"viem\";\nvar _options, _walletClient;\nvar MockProvider = class {\n constructor(options) {\n this.events = new EventEmitter();\n __privateAdd(this, _options, void 0);\n __privateAdd(this, _walletClient, void 0);\n this.chainId = options.chainId;\n __privateSet(this, _options, options);\n }\n async enable() {\n if (__privateGet(this, _options).flags?.failConnect)\n throw new UserRejectedRequestError(new Error(\"Failed to connect.\"));\n if (!__privateGet(this, _walletClient))\n __privateSet(this, _walletClient, __privateGet(this, _options).walletClient);\n const address = __privateGet(this, _walletClient).account.address;\n this.events.emit(\"accountsChanged\", [address]);\n return [address];\n }\n async disconnect() {\n this.events.emit(\"disconnect\");\n __privateSet(this, _walletClient, void 0);\n }\n async getAccounts() {\n const address = __privateGet(this, _walletClient)?.account.address;\n if (!address)\n return [];\n return [getAddress(address)];\n }\n getWalletClient() {\n const walletClient = __privateGet(this, _walletClient);\n if (!walletClient)\n throw new Error(\"walletClient not found\");\n return walletClient;\n }\n async switchChain(chainId) {\n if (__privateGet(this, _options).flags?.failSwitchChain)\n throw new UserRejectedRequestError(new Error(\"Failed to switch chain.\"));\n __privateGet(this, _options).chainId = chainId;\n this.chainId = chainId;\n this.events.emit(\"chainChanged\", chainId);\n }\n async switchWalletClient(walletClient) {\n const address = walletClient.account.address;\n __privateSet(this, _walletClient, walletClient);\n this.events.emit(\"accountsChanged\", [address]);\n }\n async watchAsset(_asset) {\n return true;\n }\n async request({ method, params }) {\n return __privateGet(this, _walletClient)?.transport.request({ method, params });\n }\n on(event, listener) {\n this.events.on(event, listener);\n return this;\n }\n removeListener(event, listener) {\n this.events.removeListener(event, listener);\n return this;\n }\n toJSON() {\n return \"\";\n }\n};\n_options = new WeakMap();\n_walletClient = new WeakMap();\n\n// src/mock/connector.ts\nvar _provider, _switchChain, switchChain_fn;\nvar MockConnector = class extends Connector {\n constructor({\n chains,\n options\n }) {\n super({\n chains,\n options: {\n ...options,\n chainId: options.chainId ?? chains?.[0]?.id\n }\n });\n __privateAdd(this, _switchChain);\n this.id = \"mock\";\n this.name = \"Mock\";\n this.ready = true;\n __privateAdd(this, _provider, void 0);\n this.onAccountsChanged = (accounts) => {\n if (accounts.length === 0)\n this.emit(\"disconnect\");\n else\n this.emit(\"change\", { account: getAddress2(accounts[0]) });\n };\n this.onChainChanged = (chainId) => {\n const id = normalizeChainId(chainId);\n const unsupported = this.isChainUnsupported(id);\n this.emit(\"change\", { chain: { id, unsupported } });\n };\n this.onDisconnect = () => {\n this.emit(\"disconnect\");\n };\n }\n async connect({ chainId } = {}) {\n const provider = await this.getProvider({ chainId });\n provider.on(\"accountsChanged\", this.onAccountsChanged);\n provider.on(\"chainChanged\", this.onChainChanged);\n provider.on(\"disconnect\", this.onDisconnect);\n this.emit(\"message\", { type: \"connecting\" });\n const accounts = await provider.enable();\n const account = getAddress2(accounts[0]);\n const id = normalizeChainId(provider.chainId);\n const unsupported = this.isChainUnsupported(id);\n const data = { account, chain: { id, unsupported }, provider };\n if (!this.options.flags?.noSwitchChain)\n this.switchChain = __privateMethod(this, _switchChain, switchChain_fn);\n return new Promise(\n (res) => setTimeout(() => res(data), 100)\n );\n }\n async disconnect() {\n const provider = await this.getProvider();\n await provider.disconnect();\n provider.removeListener(\"accountsChanged\", this.onAccountsChanged);\n provider.removeListener(\"chainChanged\", this.onChainChanged);\n provider.removeListener(\"disconnect\", this.onDisconnect);\n }\n async getAccount() {\n const provider = await this.getProvider();\n const accounts = await provider.getAccounts();\n const account = accounts[0];\n if (!account)\n throw new Error(\"Failed to get account\");\n return getAddress2(account);\n }\n async getChainId() {\n const provider = await this.getProvider();\n return normalizeChainId(provider.chainId);\n }\n async getProvider({ chainId } = {}) {\n if (!__privateGet(this, _provider) || chainId)\n __privateSet(this, _provider, new MockProvider({\n ...this.options,\n chainId: chainId ?? this.options.chainId ?? this.chains[0].id\n }));\n return __privateGet(this, _provider);\n }\n async getWalletClient() {\n const provider = await this.getProvider();\n return provider.getWalletClient();\n }\n async isAuthorized() {\n try {\n const provider = await this.getProvider();\n const account = await provider.getAccounts();\n return this.options.flags?.isAuthorized ?? !!account;\n } catch {\n return false;\n }\n }\n async watchAsset(asset) {\n const provider = await this.getProvider();\n return provider.watchAsset(asset);\n }\n toJSON() {\n return \"\";\n }\n};\n_provider = new WeakMap();\n_switchChain = new WeakSet();\nswitchChain_fn = async function(chainId) {\n const provider = await this.getProvider();\n await provider.switchChain(chainId);\n return this.chains.find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${chainId}`,\n network: `${chainId}`,\n nativeCurrency: { name: \"Ether\", decimals: 18, symbol: \"ETH\" },\n rpcUrls: { default: { http: [\"\"] }, public: { http: [\"\"] } }\n };\n};\nexport {\n MockConnector,\n MockProvider\n};\n","// src/errors.ts\nvar ChainNotConfiguredForConnectorError = class extends Error {\n constructor({\n chainId,\n connectorId\n }) {\n super(`Chain \"${chainId}\" not configured for connector \"${connectorId}\".`);\n this.name = \"ChainNotConfiguredForConnectorError\";\n }\n};\nvar ConnectorNotFoundError = class extends Error {\n constructor() {\n super(...arguments);\n this.name = \"ConnectorNotFoundError\";\n this.message = \"Connector not found\";\n }\n};\n\nexport {\n ChainNotConfiguredForConnectorError,\n ConnectorNotFoundError\n};\n","import {\n ChainNotConfiguredForConnectorError,\n ConnectorNotFoundError\n} from \"./chunk-UGBGYVBH.js\";\nimport {\n normalizeChainId\n} from \"./chunk-OQILYQDO.js\";\nimport {\n Connector,\n __privateAdd,\n __privateGet,\n __privateSet\n} from \"./chunk-W65LBPLT.js\";\n\n// src/injected.ts\nimport {\n ResourceUnavailableRpcError,\n SwitchChainError,\n UserRejectedRequestError,\n createWalletClient,\n custom,\n getAddress,\n numberToHex\n} from \"viem\";\n\n// src/utils/getInjectedName.ts\nfunction getInjectedName(ethereum) {\n if (!ethereum)\n return \"Injected\";\n const getName = (provider) => {\n if (provider.isApexWallet)\n return \"Apex Wallet\";\n if (provider.isAvalanche)\n return \"Core Wallet\";\n if (provider.isBackpack)\n return \"Backpack\";\n if (provider.isBifrost)\n return \"Bifrost Wallet\";\n if (provider.isBitKeep)\n return \"BitKeep\";\n if (provider.isBitski)\n return \"Bitski\";\n if (provider.isBlockWallet)\n return \"BlockWallet\";\n if (provider.isBraveWallet)\n return \"Brave Wallet\";\n if (provider.isCoin98)\n return \"Coin98 Wallet\";\n if (provider.isCoinbaseWallet)\n return \"Coinbase Wallet\";\n if (provider.isDawn)\n return \"Dawn Wallet\";\n if (provider.isDefiant)\n return \"Defiant\";\n if (provider.isDesig)\n return \"Desig Wallet\";\n if (provider.isEnkrypt)\n return \"Enkrypt\";\n if (provider.isExodus)\n return \"Exodus\";\n if (provider.isFordefi)\n return \"Fordefi\";\n if (provider.isFrame)\n return \"Frame\";\n if (provider.isFrontier)\n return \"Frontier Wallet\";\n if (provider.isGamestop)\n return \"GameStop Wallet\";\n if (provider.isHaqqWallet)\n return \"HAQQ Wallet\";\n if (provider.isHyperPay)\n return \"HyperPay Wallet\";\n if (provider.isImToken)\n return \"ImToken\";\n if (provider.isHaloWallet)\n return \"Halo Wallet\";\n if (provider.isKuCoinWallet)\n return \"KuCoin Wallet\";\n if (provider.isMathWallet)\n return \"MathWallet\";\n if (provider.isNovaWallet)\n return \"Nova Wallet\";\n if (provider.isOkxWallet || provider.isOKExWallet)\n return \"OKX Wallet\";\n if (provider.isOneInchIOSWallet || provider.isOneInchAndroidWallet)\n return \"1inch Wallet\";\n if (provider.isOpera)\n return \"Opera\";\n if (provider.isPhantom)\n return \"Phantom\";\n if (provider.isPortal)\n return \"Ripio Portal\";\n if (provider.isRabby)\n return \"Rabby Wallet\";\n if (provider.isRainbow)\n return \"Rainbow\";\n if (provider.isStatus)\n return \"Status\";\n if (provider.isSubWallet)\n return \"SubWallet\";\n if (provider.isTalisman)\n return \"Talisman\";\n if (provider.isTally)\n return \"Taho\";\n if (provider.isTokenPocket)\n return \"TokenPocket\";\n if (provider.isTokenary)\n return \"Tokenary\";\n if (provider.isTrust || provider.isTrustWallet)\n return \"Trust Wallet\";\n if (provider.isTTWallet)\n return \"TTWallet\";\n if (provider.isXDEFI)\n return \"XDEFI Wallet\";\n if (provider.isZeal)\n return \"Zeal\";\n if (provider.isZerion)\n return \"Zerion\";\n if (provider.isMetaMask)\n return \"MetaMask\";\n };\n if (ethereum.providers?.length) {\n const nameSet = /* @__PURE__ */ new Set();\n let unknownCount = 1;\n for (const provider of ethereum.providers) {\n let name = getName(provider);\n if (!name) {\n name = `Unknown Wallet #${unknownCount}`;\n unknownCount += 1;\n }\n nameSet.add(name);\n }\n const names = [...nameSet];\n if (names.length)\n return names;\n return names[0] ?? \"Injected\";\n }\n return getName(ethereum) ?? \"Injected\";\n}\n\n// src/injected.ts\nvar _provider;\nvar InjectedConnector = class extends Connector {\n constructor({\n chains,\n options: options_\n } = {}) {\n const options = {\n shimDisconnect: true,\n getProvider() {\n if (typeof window === \"undefined\")\n return;\n const ethereum = window.ethereum;\n if (ethereum?.providers)\n return ethereum.providers[0];\n return ethereum;\n },\n ...options_\n };\n super({ chains, options });\n this.id = \"injected\";\n __privateAdd(this, _provider, void 0);\n this.shimDisconnectKey = `${this.id}.shimDisconnect`;\n this.onAccountsChanged = (accounts) => {\n if (accounts.length === 0)\n this.emit(\"disconnect\");\n else\n this.emit(\"change\", {\n account: getAddress(accounts[0])\n });\n };\n this.onChainChanged = (chainId) => {\n const id = normalizeChainId(chainId);\n const unsupported = this.isChainUnsupported(id);\n this.emit(\"change\", { chain: { id, unsupported } });\n };\n this.onDisconnect = async (error) => {\n if (error.code === 1013) {\n const provider = await this.getProvider();\n if (provider) {\n const isAuthorized = await this.getAccount();\n if (isAuthorized)\n return;\n }\n }\n this.emit(\"disconnect\");\n if (this.options.shimDisconnect)\n this.storage?.removeItem(this.shimDisconnectKey);\n };\n const provider = options.getProvider();\n if (typeof options.name === \"string\")\n this.name = options.name;\n else if (provider) {\n const detectedName = getInjectedName(provider);\n if (options.name)\n this.name = options.name(detectedName);\n else {\n if (typeof detectedName === \"string\")\n this.name = detectedName;\n else\n this.name = detectedName[0];\n }\n } else\n this.name = \"Injected\";\n this.ready = !!provider;\n }\n async connect({ chainId } = {}) {\n try {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n if (provider.on) {\n provider.on(\"accountsChanged\", this.onAccountsChanged);\n provider.on(\"chainChanged\", this.onChainChanged);\n provider.on(\"disconnect\", this.onDisconnect);\n }\n this.emit(\"message\", { type: \"connecting\" });\n const accounts = await provider.request({\n method: \"eth_requestAccounts\"\n });\n const account = getAddress(accounts[0]);\n let id = await this.getChainId();\n let unsupported = this.isChainUnsupported(id);\n if (chainId && id !== chainId) {\n const chain = await this.switchChain(chainId);\n id = chain.id;\n unsupported = this.isChainUnsupported(id);\n }\n if (this.options.shimDisconnect)\n this.storage?.setItem(this.shimDisconnectKey, true);\n return { account, chain: { id, unsupported } };\n } catch (error) {\n if (this.isUserRejectedRequestError(error))\n throw new UserRejectedRequestError(error);\n if (error.code === -32002)\n throw new ResourceUnavailableRpcError(error);\n throw error;\n }\n }\n async disconnect() {\n const provider = await this.getProvider();\n if (!provider?.removeListener)\n return;\n provider.removeListener(\"accountsChanged\", this.onAccountsChanged);\n provider.removeListener(\"chainChanged\", this.onChainChanged);\n provider.removeListener(\"disconnect\", this.onDisconnect);\n if (this.options.shimDisconnect)\n this.storage?.removeItem(this.shimDisconnectKey);\n }\n async getAccount() {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n const accounts = await provider.request({\n method: \"eth_accounts\"\n });\n return getAddress(accounts[0]);\n }\n async getChainId() {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n return provider.request({ method: \"eth_chainId\" }).then(normalizeChainId);\n }\n async getProvider() {\n const provider = this.options.getProvider();\n if (provider)\n __privateSet(this, _provider, provider);\n return __privateGet(this, _provider);\n }\n async getWalletClient({\n chainId\n } = {}) {\n const [provider, account] = await Promise.all([\n this.getProvider(),\n this.getAccount()\n ]);\n const chain = this.chains.find((x) => x.id === chainId);\n if (!provider)\n throw new Error(\"provider is required.\");\n return createWalletClient({\n account,\n chain,\n transport: custom(provider)\n });\n }\n async isAuthorized() {\n try {\n if (this.options.shimDisconnect && !this.storage?.getItem(this.shimDisconnectKey))\n return false;\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n const account = await this.getAccount();\n return !!account;\n } catch {\n return false;\n }\n }\n async switchChain(chainId) {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n const id = numberToHex(chainId);\n try {\n await Promise.all([\n provider.request({\n method: \"wallet_switchEthereumChain\",\n params: [{ chainId: id }]\n }),\n new Promise(\n (res) => this.on(\"change\", ({ chain }) => {\n if (chain?.id === chainId)\n res();\n })\n )\n ]);\n return this.chains.find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${id}`,\n network: `${id}`,\n nativeCurrency: { name: \"Ether\", decimals: 18, symbol: \"ETH\" },\n rpcUrls: { default: { http: [\"\"] }, public: { http: [\"\"] } }\n };\n } catch (error) {\n const chain = this.chains.find((x) => x.id === chainId);\n if (!chain)\n throw new ChainNotConfiguredForConnectorError({\n chainId,\n connectorId: this.id\n });\n if (error.code === 4902 || error?.data?.originalError?.code === 4902) {\n try {\n await provider.request({\n method: \"wallet_addEthereumChain\",\n params: [\n {\n chainId: id,\n chainName: chain.name,\n nativeCurrency: chain.nativeCurrency,\n rpcUrls: [chain.rpcUrls.public?.http[0] ?? \"\"],\n blockExplorerUrls: this.getBlockExplorerUrls(chain)\n }\n ]\n });\n const currentChainId = await this.getChainId();\n if (currentChainId !== chainId)\n throw new UserRejectedRequestError(\n new Error(\"User rejected switch after adding network.\")\n );\n return chain;\n } catch (error2) {\n throw new UserRejectedRequestError(error2);\n }\n }\n if (this.isUserRejectedRequestError(error))\n throw new UserRejectedRequestError(error);\n throw new SwitchChainError(error);\n }\n }\n async watchAsset({\n address,\n decimals = 18,\n image,\n symbol\n }) {\n const provider = await this.getProvider();\n if (!provider)\n throw new ConnectorNotFoundError();\n return provider.request({\n method: \"wallet_watchAsset\",\n params: {\n type: \"ERC20\",\n options: {\n address,\n decimals,\n image,\n symbol\n }\n }\n });\n }\n isUserRejectedRequestError(error) {\n return error.code === 4001;\n }\n};\n_provider = new WeakMap();\n\nexport {\n InjectedConnector\n};\n","var __accessCheck = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n};\nvar __privateGet = (obj, member, getter) => {\n __accessCheck(obj, member, \"read from private field\");\n return getter ? getter.call(obj) : member.get(obj);\n};\nvar __privateAdd = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n};\nvar __privateSet = (obj, member, value, setter) => {\n __accessCheck(obj, member, \"write to private field\");\n setter ? setter.call(obj, value) : member.set(obj, value);\n return value;\n};\nvar __privateMethod = (obj, member, method) => {\n __accessCheck(obj, member, \"access private method\");\n return method;\n};\n\nexport {\n __privateGet,\n __privateAdd,\n __privateSet,\n __privateMethod\n};\n","import {\n InjectedConnector\n} from \"./chunk-BVC4KGLQ.js\";\nimport {\n __privateAdd,\n __privateGet,\n __privateMethod,\n __privateSet\n} from \"./chunk-MQXBDTVK.js\";\n\n// src/utils/configureChains.ts\nimport { createPublicClient, fallback, http, webSocket } from \"viem\";\nfunction configureChains(defaultChains, providers, {\n batch = { multicall: { wait: 32 } },\n pollingInterval = 4e3,\n rank,\n retryCount,\n retryDelay,\n stallTimeout\n} = {}) {\n if (!defaultChains.length)\n throw new Error(\"must have at least one chain\");\n let chains = [];\n const httpUrls = {};\n const wsUrls = {};\n for (const chain of defaultChains) {\n let configExists = false;\n for (const provider of providers) {\n const apiConfig = provider(chain);\n if (!apiConfig)\n continue;\n configExists = true;\n if (!chains.some(({ id }) => id === chain.id)) {\n chains = [...chains, apiConfig.chain];\n }\n httpUrls[chain.id] = [\n ...httpUrls[chain.id] || [],\n ...apiConfig.rpcUrls.http\n ];\n if (apiConfig.rpcUrls.webSocket) {\n wsUrls[chain.id] = [\n ...wsUrls[chain.id] || [],\n ...apiConfig.rpcUrls.webSocket\n ];\n }\n }\n if (!configExists) {\n throw new Error(\n [\n `Could not find valid provider configuration for chain \"${chain.name}\".\n`,\n \"You may need to add `jsonRpcProvider` to `configureChains` with the chain's RPC URLs.\",\n \"Read more: https://wagmi.sh/core/providers/jsonRpc\"\n ].join(\"\\n\")\n );\n }\n }\n return {\n chains,\n publicClient: ({ chainId }) => {\n const activeChain = chains.find((x) => x.id === chainId) ?? defaultChains[0];\n const chainHttpUrls = httpUrls[activeChain.id];\n if (!chainHttpUrls || !chainHttpUrls[0])\n throw new Error(`No providers configured for chain \"${activeChain.id}\"`);\n const publicClient = createPublicClient({\n batch,\n chain: activeChain,\n transport: fallback(\n chainHttpUrls.map((url) => http(url, { timeout: stallTimeout })),\n { rank, retryCount, retryDelay }\n ),\n pollingInterval\n });\n return Object.assign(publicClient, {\n chains\n });\n },\n webSocketPublicClient: ({ chainId }) => {\n const activeChain = chains.find((x) => x.id === chainId) ?? defaultChains[0];\n const chainWsUrls = wsUrls[activeChain.id];\n if (!chainWsUrls || !chainWsUrls[0])\n return void 0;\n const publicClient = createPublicClient({\n batch,\n chain: activeChain,\n transport: fallback(\n chainWsUrls.map((url) => webSocket(url, { timeout: stallTimeout })),\n { rank, retryCount, retryDelay }\n ),\n pollingInterval\n });\n return Object.assign(publicClient, {\n chains\n });\n }\n };\n}\n\n// src/errors.ts\nimport { ConnectorNotFoundError } from \"@wagmi/connectors\";\nvar ChainMismatchError = class extends Error {\n constructor({\n activeChain,\n targetChain\n }) {\n super(\n `Chain mismatch: Expected \"${targetChain}\", received \"${activeChain}\".`\n );\n this.name = \"ChainMismatchError\";\n }\n};\nvar ChainNotConfiguredError = class extends Error {\n constructor({\n chainId,\n connectorId\n }) {\n super(\n `Chain \"${chainId}\" not configured${connectorId ? ` for connector \"${connectorId}\"` : \"\"}.`\n );\n this.name = \"ChainNotConfigured\";\n }\n};\nvar ConnectorAlreadyConnectedError = class extends Error {\n constructor() {\n super(...arguments);\n this.name = \"ConnectorAlreadyConnectedError\";\n this.message = \"Connector already connected\";\n }\n};\nvar ConfigChainsNotFound = class extends Error {\n constructor() {\n super(...arguments);\n this.name = \"ConfigChainsNotFound\";\n this.message = \"No chains were found on the wagmi config. Some functions that require a chain may not work.\";\n }\n};\nvar SwitchChainNotSupportedError = class extends Error {\n constructor({ connector }) {\n super(`\"${connector.name}\" does not support programmatic chain switching.`);\n this.name = \"SwitchChainNotSupportedError\";\n }\n};\n\n// src/utils/deepEqual.ts\nfunction 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 return a !== a && b !== b;\n}\n\n// src/utils/deserialize.ts\nvar findAndReplace = (cacheRef, {\n find,\n replace\n}) => {\n if (cacheRef && find(cacheRef)) {\n return replace(cacheRef);\n }\n if (typeof cacheRef !== \"object\") {\n return cacheRef;\n }\n if (Array.isArray(cacheRef)) {\n return cacheRef.map((item) => findAndReplace(item, { find, replace }));\n }\n if (cacheRef instanceof Object) {\n return Object.entries(cacheRef).reduce(\n (curr, [key, value]) => ({\n ...curr,\n [key]: findAndReplace(value, { find, replace })\n }),\n {}\n );\n }\n return cacheRef;\n};\nfunction deserialize(cachedString) {\n const cache = JSON.parse(cachedString);\n const deserializedCacheWithBigInts = findAndReplace(cache, {\n find: (data) => typeof data === \"string\" && data.startsWith(\"#bigint.\"),\n replace: (data) => BigInt(data.replace(\"#bigint.\", \"\"))\n });\n return deserializedCacheWithBigInts;\n}\n\n// src/utils/getParameters.ts\nfunction getCallParameters(args) {\n return {\n accessList: args.accessList,\n account: args.account,\n blockNumber: args.blockNumber,\n blockTag: args.blockTag,\n data: args.data,\n gas: args.gas,\n gasPrice: args.gasPrice,\n maxFeePerGas: args.maxFeePerGas,\n maxPriorityFeePerGas: args.maxPriorityFeePerGas,\n nonce: args.nonce,\n to: args.to,\n value: args.value\n };\n}\nfunction getSendTransactionParameters(args) {\n return {\n accessList: args.accessList,\n account: args.account,\n data: args.data,\n gas: args.gas,\n gasPrice: args.gasPrice,\n maxFeePerGas: args.maxFeePerGas,\n maxPriorityFeePerGas: args.maxPriorityFeePerGas,\n nonce: args.nonce,\n to: args.to,\n value: args.value\n };\n}\n\n// src/utils/getUnit.ts\nimport { weiUnits } from \"viem\";\nfunction 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\n// src/utils/serialize.ts\nfunction getReferenceKey(keys, cutoff) {\n return keys.slice(0, cutoff).join(\".\") || \".\";\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}\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 } 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 ? circularReplacer.call(\n this,\n key,\n value,\n getReferenceKey(keys, valueCutoff)\n ) : `[ref=${getReferenceKey(keys, valueCutoff)}]`;\n }\n } else {\n cache[0] = value;\n keys[0] = key;\n }\n }\n return hasReplacer ? replacer.call(this, key, value) : value;\n };\n}\nfunction serialize(value, replacer, indent, circularReplacer) {\n return JSON.stringify(\n value,\n createReplacer((key, value_) => {\n const value2 = typeof value_ === \"bigint\" ? `#bigint.${value_.toString()}` : value_;\n return replacer?.(key, value2) || value2;\n }, circularReplacer),\n indent ?? void 0\n );\n}\n\n// src/config.ts\nimport { persist, subscribeWithSelector } from \"zustand/middleware\";\nimport { createStore } from \"zustand/vanilla\";\n\n// src/storage.ts\nvar noopStorage = {\n getItem: (_key) => \"\",\n setItem: (_key, _value) => null,\n removeItem: (_key) => null\n};\nfunction createStorage({\n deserialize: deserialize2 = deserialize,\n key: prefix = \"wagmi\",\n serialize: serialize2 = serialize,\n storage\n}) {\n return {\n ...storage,\n getItem: (key, defaultState = null) => {\n const value = storage.getItem(`${prefix}.${key}`);\n try {\n return value ? deserialize2(value) : defaultState;\n } catch (error) {\n console.warn(error);\n return defaultState;\n }\n },\n setItem: (key, value) => {\n if (value === null) {\n storage.removeItem(`${prefix}.${key}`);\n } else {\n try {\n storage.setItem(`${prefix}.${key}`, serialize2(value));\n } catch (err) {\n console.error(err);\n }\n }\n },\n removeItem: (key) => storage.removeItem(`${prefix}.${key}`)\n };\n}\n\n// src/config.ts\nvar storeKey = \"store\";\nvar _isAutoConnecting, _lastUsedConnector, _addEffects, addEffects_fn;\nvar Config = class {\n constructor({\n autoConnect = false,\n connectors = [new InjectedConnector()],\n publicClient,\n storage = createStorage({\n storage: typeof window !== \"undefined\" ? window.localStorage : noopStorage\n }),\n logger = {\n warn: console.warn\n },\n webSocketPublicClient\n }) {\n __privateAdd(this, _addEffects);\n this.publicClients = /* @__PURE__ */ new Map();\n this.webSocketPublicClients = /* @__PURE__ */ new Map();\n __privateAdd(this, _isAutoConnecting, void 0);\n __privateAdd(this, _lastUsedConnector, void 0);\n this.args = {\n autoConnect,\n connectors,\n logger,\n publicClient,\n storage,\n webSocketPublicClient\n };\n let status = \"disconnected\";\n let chainId;\n if (autoConnect) {\n try {\n const rawState = storage.getItem(storeKey);\n const data = rawState?.state?.data;\n status = data?.account ? \"reconnecting\" : \"connecting\";\n chainId = data?.chain?.id;\n } catch (_error) {\n }\n }\n const connectors_ = typeof connectors === \"function\" ? connectors() : connectors;\n connectors_.forEach((connector) => connector.setStorage(storage));\n this.store = createStore(\n subscribeWithSelector(\n persist(\n () => ({\n connectors: connectors_,\n publicClient: this.getPublicClient({ chainId }),\n status,\n webSocketPublicClient: this.getWebSocketPublicClient({ chainId })\n }),\n {\n name: storeKey,\n storage,\n partialize: (state) => ({\n ...autoConnect && {\n data: {\n account: state?.data?.account,\n chain: state?.data?.chain\n }\n },\n chains: state?.chains\n }),\n version: 2\n }\n )\n )\n );\n this.storage = storage;\n __privateSet(this, _lastUsedConnector, storage?.getItem(\"wallet\"));\n __privateMethod(this, _addEffects, addEffects_fn).call(this);\n if (autoConnect && typeof window !== \"undefined\")\n setTimeout(async () => await this.autoConnect(), 0);\n }\n get chains() {\n return this.store.getState().chains;\n }\n get connectors() {\n return this.store.getState().connectors;\n }\n get connector() {\n return this.store.getState().connector;\n }\n get data() {\n return this.store.getState().data;\n }\n get error() {\n return this.store.getState().error;\n }\n get lastUsedChainId() {\n return this.data?.chain?.id;\n }\n get publicClient() {\n return this.store.getState().publicClient;\n }\n get status() {\n return this.store.getState().status;\n }\n get subscribe() {\n return this.store.subscribe;\n }\n get webSocketPublicClient() {\n return this.store.getState().webSocketPublicClient;\n }\n setState(updater) {\n const newState = typeof updater === \"function\" ? updater(this.store.getState()) : updater;\n this.store.setState(newState, true);\n }\n clearState() {\n this.setState((x) => ({\n ...x,\n chains: void 0,\n connector: void 0,\n data: void 0,\n error: void 0,\n status: \"disconnected\"\n }));\n }\n async destroy() {\n if (this.connector)\n await this.connector.disconnect?.();\n __privateSet(this, _isAutoConnecting, false);\n this.clearState();\n this.store.destroy();\n }\n async autoConnect() {\n if (__privateGet(this, _isAutoConnecting))\n return;\n __privateSet(this, _isAutoConnecting, true);\n this.setState((x) => ({\n ...x,\n status: x.data?.account ? \"reconnecting\" : \"connecting\"\n }));\n const sorted = __privateGet(this, _lastUsedConnector) ? [...this.connectors].sort(\n (x) => x.id === __privateGet(this, _lastUsedConnector) ? -1 : 1\n ) : this.connectors;\n let connected = false;\n for (const connector of sorted) {\n if (!connector.ready || !connector.isAuthorized)\n continue;\n const isAuthorized = await connector.isAuthorized();\n if (!isAuthorized)\n continue;\n const data = await connector.connect();\n this.setState((x) => ({\n ...x,\n connector,\n chains: connector?.chains,\n data,\n status: \"connected\"\n }));\n connected = true;\n break;\n }\n if (!connected)\n this.setState((x) => ({\n ...x,\n data: void 0,\n status: \"disconnected\"\n }));\n __privateSet(this, _isAutoConnecting, false);\n return this.data;\n }\n setConnectors(connectors) {\n this.args = {\n ...this.args,\n connectors\n };\n const connectors_ = typeof connectors === \"function\" ? connectors() : connectors;\n connectors_.forEach((connector) => connector.setStorage(this.args.storage));\n this.setState((x) => ({\n ...x,\n connectors: connectors_\n }));\n }\n getPublicClient({ chainId } = {}) {\n let publicClient_ = this.publicClients.get(-1);\n if (publicClient_ && publicClient_?.chain.id === chainId)\n return publicClient_;\n publicClient_ = this.publicClients.get(chainId ?? -1);\n if (publicClient_)\n return publicClient_;\n const { publicClient } = this.args;\n publicClient_ = typeof publicClient === \"function\" ? publicClient({ chainId }) : publicClient;\n this.publicClients.set(chainId ?? -1, publicClient_);\n return publicClient_;\n }\n setPublicClient(publicClient) {\n const chainId = this.data?.chain?.id;\n this.args = {\n ...this.args,\n publicClient\n };\n this.publicClients.clear();\n this.setState((x) => ({\n ...x,\n publicClient: this.getPublicClient({ chainId })\n }));\n }\n getWebSocketPublicClient({ chainId } = {}) {\n let webSocketPublicClient_ = this.webSocketPublicClients.get(-1);\n if (webSocketPublicClient_ && webSocketPublicClient_?.chain.id === chainId)\n return webSocketPublicClient_;\n webSocketPublicClient_ = this.webSocketPublicClients.get(chainId ?? -1);\n if (webSocketPublicClient_)\n return webSocketPublicClient_;\n const { webSocketPublicClient } = this.args;\n webSocketPublicClient_ = typeof webSocketPublicClient === \"function\" ? webSocketPublicClient({ chainId }) : webSocketPublicClient;\n if (webSocketPublicClient_)\n this.webSocketPublicClients.set(chainId ?? -1, webSocketPublicClient_);\n return webSocketPublicClient_;\n }\n setWebSocketPublicClient(webSocketPublicClient) {\n const chainId = this.data?.chain?.id;\n this.args = {\n ...this.args,\n webSocketPublicClient\n };\n this.webSocketPublicClients.clear();\n this.setState((x) => ({\n ...x,\n webSocketPublicClient: this.getWebSocketPublicClient({\n chainId\n })\n }));\n }\n setLastUsedConnector(lastUsedConnector = null) {\n this.storage?.setItem(\"wallet\", lastUsedConnector);\n }\n};\n_isAutoConnecting = new WeakMap();\n_lastUsedConnector = new WeakMap();\n_addEffects = new WeakSet();\naddEffects_fn = function() {\n const onChange = (data) => {\n this.setState((x) => ({\n ...x,\n data: { ...x.data, ...data }\n }));\n };\n const onDisconnect = () => {\n this.clearState();\n };\n const onError = (error) => {\n this.setState((x) => ({ ...x, error }));\n };\n this.store.subscribe(\n ({ connector }) => connector,\n (connector, prevConnector) => {\n prevConnector?.off?.(\"change\", onChange);\n prevConnector?.off?.(\"disconnect\", onDisconnect);\n prevConnector?.off?.(\"error\", onError);\n if (!connector)\n return;\n connector.on?.(\"change\", onChange);\n connector.on?.(\"disconnect\", onDisconnect);\n connector.on?.(\"error\", onError);\n }\n );\n const { publicClient, webSocketPublicClient } = this.args;\n const subscribePublicClient = typeof publicClient === \"function\";\n const subscribeWebSocketPublicClient = typeof webSocketPublicClient === \"function\";\n if (subscribePublicClient || subscribeWebSocketPublicClient)\n this.store.subscribe(\n ({ data }) => data?.chain?.id,\n (chainId) => {\n this.setState((x) => ({\n ...x,\n publicClient: this.getPublicClient({ chainId }),\n webSocketPublicClient: this.getWebSocketPublicClient({\n chainId\n })\n }));\n }\n );\n};\nvar config;\nfunction createConfig(args) {\n const config_ = new Config(args);\n config = config_;\n return config_;\n}\nfunction getConfig() {\n if (!config) {\n throw new Error(\n \"No wagmi config found. Ensure you have set up a config: https://wagmi.sh/react/config\"\n );\n }\n return config;\n}\n\n// src/actions/accounts/connect.ts\nasync function connect({ chainId, connector }) {\n const config2 = getConfig();\n const activeConnector = config2.connector;\n if (activeConnector && connector.id === activeConnector.id)\n throw new ConnectorAlreadyConnectedError();\n try {\n config2.setState((x) => ({ ...x, status: \"connecting\" }));\n const data = await connector.connect({ chainId });\n config2.setLastUsedConnector(connector.id);\n config2.setState((x) => ({\n ...x,\n connector,\n chains: connector?.chains,\n data,\n status: \"connected\"\n }));\n config2.storage.setItem(\"connected\", true);\n return { ...data, connector };\n } catch (err) {\n config2.setState((x) => {\n return {\n ...x,\n status: x.connector ? \"connected\" : \"disconnected\"\n };\n });\n throw err;\n }\n}\n\n// src/actions/accounts/disconnect.ts\nasync function disconnect() {\n const config2 = getConfig();\n if (config2.connector)\n await config2.connector.disconnect();\n config2.clearState();\n config2.storage.removeItem(\"connected\");\n}\n\n// src/actions/accounts/fetchBalance.ts\nimport {\n ContractFunctionExecutionError as ContractFunctionExecutionError3,\n formatUnits as formatUnits2,\n hexToString as hexToString2,\n trim as trim2\n} from \"viem\";\n\n// src/constants/abis.ts\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"uint256\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"decimals\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint8\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"name\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"string\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"symbol\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"string\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"totalSupply\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"bool\"\n }\n ]\n }\n];\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"uint256\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"decimals\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"uint8\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"name\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"symbol\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"bytes32\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"totalSupply\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"bool\"\n }\n ]\n }\n];\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"bool\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"name\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\n type: \"string\"\n }\n ]\n },\n {\n type: \"function\",\n name: \"totalSupply\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [\n {\n name: \"\",\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];\nvar 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 name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\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 name: \"\",\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\n// src/actions/contracts/fetchToken.ts\nimport {\n ContractFunctionExecutionError,\n formatUnits,\n hexToString,\n trim\n} from \"viem\";\nasync function fetchToken({\n address,\n chainId,\n formatUnits: unit = 18\n}) {\n async function fetchToken_({ abi }) {\n const erc20Config = { address, abi, chainId };\n const [decimals, name, symbol, totalSupply] = await readContracts({\n allowFailure: false,\n contracts: [\n { ...erc20Config, functionName: \"decimals\" },\n { ...erc20Config, functionName: \"name\" },\n { ...erc20Config, functionName: \"symbol\" },\n { ...erc20Config, functionName: \"totalSupply\" }\n ]\n });\n return {\n address,\n decimals,\n name,\n symbol,\n totalSupply: {\n formatted: formatUnits(totalSupply, getUnit(unit)),\n value: totalSupply\n }\n };\n }\n try {\n return await fetchToken_({ abi: erc20ABI });\n } catch (err) {\n if (err instanceof ContractFunctionExecutionError) {\n const { name, symbol, ...rest } = await fetchToken_({\n abi: erc20ABI_bytes32\n });\n return {\n name: hexToString(trim(name, { dir: \"right\" })),\n symbol: hexToString(trim(symbol, { dir: \"right\" })),\n ...rest\n };\n }\n throw err;\n }\n}\n\n// src/actions/viem/getPublicClient.ts\nfunction getPublicClient({ chainId } = {}) {\n const config2 = getConfig();\n if (chainId)\n return config2.getPublicClient({ chainId }) || config2.publicClient;\n return config2.publicClient;\n}\n\n// src/actions/viem/getWalletClient.ts\nasync function getWalletClient({\n chainId\n} = {}) {\n const config2 = getConfig();\n const walletClient = await config2.connector?.getWalletClient?.({ chainId }) || null;\n return walletClient;\n}\n\n// src/actions/viem/getWebSocketPublicClient.ts\nfunction getWebSocketPublicClient({\n chainId\n} = {}) {\n const config2 = getConfig();\n if (chainId)\n return config2.getWebSocketPublicClient({ chainId }) || config2.webSocketPublicClient;\n return config2.webSocketPublicClient;\n}\n\n// src/actions/viem/watchPublicClient.ts\nfunction watchPublicClient(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(getPublicClient(args));\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return unsubscribe;\n}\n\n// src/actions/viem/watchWalletClient.ts\nimport { shallow } from \"zustand/shallow\";\nfunction watchWalletClient({ chainId }, callback) {\n const config2 = getConfig();\n const handleChange = async ({ chainId: chainId_ }) => {\n if (chainId && chainId_ && chainId !== chainId_)\n return;\n const walletClient = await getWalletClient({ chainId });\n if (!getConfig().connector)\n return callback(null);\n return callback(walletClient);\n };\n const unsubscribe = config2.subscribe(\n ({ data, connector }) => ({\n account: data?.account,\n chainId: data?.chain?.id,\n connector\n }),\n handleChange,\n {\n equalityFn: shallow\n }\n );\n return unsubscribe;\n}\n\n// src/actions/viem/watchWebSocketPublicClient.ts\nfunction watchWebSocketPublicClient(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(getWebSocketPublicClient(args));\n const unsubscribe = config2.subscribe(\n ({ webSocketPublicClient }) => webSocketPublicClient,\n handleChange\n );\n return unsubscribe;\n}\n\n// src/actions/contracts/prepareWriteContract.ts\nasync function prepareWriteContract({\n abi,\n address,\n args,\n chainId,\n dataSuffix,\n functionName,\n walletClient: walletClient_,\n ...config2\n}) {\n const publicClient = getPublicClient({ chainId });\n const walletClient = walletClient_ ?? await getWalletClient({ chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (chainId)\n assertActiveChain({ chainId });\n const {\n account,\n accessList,\n blockNumber,\n blockTag,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n value\n } = getCallParameters(config2);\n const { result, request } = await publicClient.simulateContract({\n abi,\n address,\n functionName,\n args,\n account: account || walletClient.account,\n accessList,\n blockNumber,\n blockTag,\n dataSuffix,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n value\n });\n const minimizedAbi = abi.filter(\n (abiItem) => \"name\" in abiItem && abiItem.name === functionName\n );\n return {\n mode: \"prepared\",\n request: {\n ...request,\n abi: minimizedAbi,\n chainId\n },\n result\n };\n}\n\n// src/actions/contracts/getContract.ts\nimport { getContract as getContract_ } from \"viem\";\nfunction getContract({\n address,\n abi,\n chainId,\n walletClient\n}) {\n const publicClient = getPublicClient({ chainId });\n return getContract_({\n address,\n abi,\n publicClient,\n walletClient\n });\n}\n\n// src/actions/contracts/multicall.ts\nasync function multicall({\n chainId,\n contracts,\n blockNumber,\n blockTag,\n ...args\n}) {\n const publicClient = getPublicClient({ chainId });\n if (!publicClient.chains)\n throw new ConfigChainsNotFound();\n if (chainId && publicClient.chain.id !== chainId)\n throw new ChainNotConfiguredError({ chainId });\n return publicClient.multicall({\n allowFailure: args.allowFailure ?? true,\n blockNumber,\n blockTag,\n contracts\n });\n}\n\n// src/actions/contracts/readContract.ts\nasync function readContract({\n address,\n account,\n chainId,\n abi,\n args,\n functionName,\n blockNumber,\n blockTag\n}) {\n const publicClient = getPublicClient({ chainId });\n return publicClient.readContract({\n abi,\n address,\n account,\n functionName,\n args,\n blockNumber,\n blockTag\n });\n}\n\n// src/actions/contracts/readContracts.ts\nimport { ContractFunctionExecutionError as ContractFunctionExecutionError2 } from \"viem\";\nasync function readContracts({\n contracts,\n blockNumber,\n blockTag,\n ...args\n}) {\n const { allowFailure = true } = args;\n try {\n const publicClient = getPublicClient();\n const contractsByChainId = contracts.reduce((contracts2, contract, index) => {\n const chainId = contract.chainId ?? publicClient.chain.id;\n return {\n ...contracts2,\n [chainId]: [...contracts2[chainId] || [], { contract, index }]\n };\n }, {});\n const promises = () => Object.entries(contractsByChainId).map(\n ([chainId, contracts2]) => multicall({\n allowFailure,\n chainId: parseInt(chainId),\n contracts: contracts2.map(\n ({ contract }) => contract\n ),\n blockNumber,\n blockTag\n })\n );\n const multicallResults = (await Promise.all(promises())).flat();\n const resultIndexes = Object.values(contractsByChainId).flatMap(\n (contracts2) => contracts2.map(({ index }) => index)\n );\n return multicallResults.reduce((results, result, index) => {\n if (results)\n results[resultIndexes[index]] = result;\n return results;\n }, []);\n } catch (err) {\n if (err instanceof ContractFunctionExecutionError2)\n throw err;\n const promises = () => contracts.map(\n (contract) => readContract({ ...contract, blockNumber, blockTag })\n );\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: void 0, status: \"failure\" };\n });\n return await Promise.all(promises());\n }\n}\n\n// src/actions/contracts/watchContractEvent.ts\nimport { shallow as shallow2 } from \"zustand/shallow\";\nfunction watchContractEvent({\n address,\n abi,\n chainId,\n eventName\n}, callback) {\n let unwatch;\n const watchEvent = async () => {\n if (unwatch)\n unwatch();\n const publicClient = getWebSocketPublicClient({ chainId }) || getPublicClient({ chainId });\n unwatch = publicClient.watchContractEvent({\n address,\n abi,\n eventName,\n onLogs: callback\n });\n };\n watchEvent();\n const config2 = getConfig();\n const unsubscribe = config2.subscribe(\n ({ publicClient, webSocketPublicClient }) => ({\n publicClient,\n webSocketPublicClient\n }),\n watchEvent,\n { equalityFn: shallow2 }\n );\n return () => {\n unwatch?.();\n unsubscribe();\n };\n}\n\n// src/actions/network-status/watchBlockNumber.ts\nimport { shallow as shallow3 } from \"zustand/shallow\";\nfunction watchBlockNumber(args, callback) {\n let unwatch;\n const createListener = (publicClient) => {\n if (unwatch)\n unwatch();\n unwatch = publicClient.watchBlockNumber({\n onBlockNumber: callback,\n emitOnBegin: true,\n poll: true\n });\n };\n const publicClient_ = getWebSocketPublicClient({ chainId: args.chainId }) ?? getPublicClient({ chainId: args.chainId });\n if (args.listen)\n createListener(publicClient_);\n const config2 = getConfig();\n const unsubscribe = config2.subscribe(\n ({ publicClient, webSocketPublicClient }) => ({\n publicClient,\n webSocketPublicClient\n }),\n async ({ publicClient, webSocketPublicClient }) => {\n const publicClient_2 = webSocketPublicClient ?? publicClient;\n if (args.listen && !args.chainId && publicClient_2) {\n createListener(publicClient_2);\n }\n },\n {\n equalityFn: shallow3\n }\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/watchMulticall.ts\nfunction watchMulticall(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(await multicall(args));\n const unwatch = args.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : void 0;\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/watchReadContract.ts\nfunction watchReadContract(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(await readContract(args));\n const unwatch = args.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : void 0;\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/watchReadContracts.ts\nfunction watchReadContracts(args, callback) {\n const config2 = getConfig();\n const handleChange = async () => callback(await readContracts(args));\n const unwatch = args.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : void 0;\n const unsubscribe = config2.subscribe(\n ({ publicClient }) => publicClient,\n handleChange\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/actions/contracts/writeContract.ts\nasync function writeContract(config2) {\n const walletClient = await getWalletClient({ chainId: config2.chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (config2.chainId)\n assertActiveChain({ chainId: config2.chainId });\n let request;\n if (config2.mode === \"prepared\") {\n request = config2.request;\n } else {\n const { chainId: _, mode: __, ...args } = config2;\n const res = await prepareWriteContract(args);\n request = res.request;\n }\n const hash = await walletClient.writeContract({\n ...request,\n chain: config2.chainId ? { id: config2.chainId } : null\n });\n return { hash };\n}\n\n// src/actions/accounts/fetchBalance.ts\nasync function fetchBalance({\n address,\n chainId,\n formatUnits: unit,\n token\n}) {\n const config2 = getConfig();\n const publicClient = getPublicClient({ chainId });\n if (token) {\n const fetchContractBalance = async ({ abi }) => {\n const erc20Config = { abi, address: token, chainId };\n const [value2, decimals, symbol] = await readContracts({\n allowFailure: false,\n contracts: [\n {\n ...erc20Config,\n functionName: \"balanceOf\",\n args: [address]\n },\n { ...erc20Config, functionName: \"decimals\" },\n { ...erc20Config, functionName: \"symbol\" }\n ]\n });\n return {\n decimals,\n formatted: formatUnits2(value2 ?? \"0\", getUnit(unit ?? decimals)),\n symbol,\n value: value2\n };\n };\n try {\n return await fetchContractBalance({ abi: erc20ABI });\n } catch (err) {\n if (err instanceof ContractFunctionExecutionError3) {\n const { symbol, ...rest } = await fetchContractBalance({\n abi: erc20ABI_bytes32\n });\n return {\n symbol: hexToString2(trim2(symbol, { dir: \"right\" })),\n ...rest\n };\n }\n throw err;\n }\n }\n const chains = [\n ...config2.publicClient.chains || [],\n ...config2.chains ?? []\n ];\n const value = await publicClient.getBalance({ address });\n const chain = chains.find((x) => x.id === publicClient.chain.id);\n return {\n decimals: chain?.nativeCurrency.decimals ?? 18,\n formatted: formatUnits2(value ?? \"0\", getUnit(unit ?? 18)),\n symbol: chain?.nativeCurrency.symbol ?? \"ETH\",\n value\n };\n}\n\n// src/actions/accounts/getAccount.ts\nfunction getAccount() {\n const { data, connector, status } = getConfig();\n switch (status) {\n case \"connected\":\n return {\n address: data?.account,\n connector,\n isConnected: true,\n isConnecting: false,\n isDisconnected: false,\n isReconnecting: false,\n status\n };\n case \"reconnecting\":\n return {\n address: data?.account,\n connector,\n isConnected: !!data?.account,\n isConnecting: false,\n isDisconnected: false,\n isReconnecting: true,\n status\n };\n case \"connecting\":\n return {\n address: data?.account,\n connector,\n isConnected: false,\n isConnecting: true,\n isDisconnected: false,\n isReconnecting: false,\n status\n };\n case \"disconnected\":\n return {\n address: void 0,\n connector: void 0,\n isConnected: false,\n isConnecting: false,\n isDisconnected: true,\n isReconnecting: false,\n status\n };\n }\n}\n\n// src/actions/accounts/getNetwork.ts\nfunction getNetwork() {\n const config2 = getConfig();\n const chainId = config2.data?.chain?.id;\n const activeChains = config2.chains ?? [];\n const activeChain = [\n ...config2.publicClient?.chains || [],\n ...activeChains\n ].find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${chainId}`,\n network: `${chainId}`,\n nativeCurrency: { name: \"Ether\", decimals: 18, symbol: \"ETH\" },\n rpcUrls: {\n default: { http: [\"\"] },\n public: { http: [\"\"] }\n }\n };\n return {\n chain: chainId ? {\n ...activeChain,\n ...config2.data?.chain,\n id: chainId\n } : void 0,\n chains: activeChains\n };\n}\n\n// src/actions/accounts/signMessage.ts\nasync function signMessage(args) {\n const walletClient = await getWalletClient();\n if (!walletClient)\n throw new ConnectorNotFoundError();\n return await walletClient.signMessage({\n message: args.message\n });\n}\n\n// src/actions/accounts/signTypedData.ts\nasync function signTypedData({\n domain,\n message,\n primaryType,\n types\n}) {\n const walletClient = await getWalletClient();\n if (!walletClient)\n throw new ConnectorNotFoundError();\n const { chainId } = domain;\n if (chainId)\n assertActiveChain({ chainId });\n return walletClient.signTypedData({\n message,\n primaryType,\n types,\n domain\n });\n}\n\n// src/actions/accounts/switchNetwork.ts\nasync function switchNetwork({\n chainId\n}) {\n const { connector } = getConfig();\n if (!connector)\n throw new ConnectorNotFoundError();\n if (!connector.switchChain)\n throw new SwitchChainNotSupportedError({\n connector\n });\n return connector.switchChain(chainId);\n}\n\n// src/actions/accounts/watchAccount.ts\nimport { shallow as shallow4 } from \"zustand/shallow\";\nfunction watchAccount(callback, { selector = (x) => x } = {}) {\n const config2 = getConfig();\n const handleChange = () => callback(getAccount());\n const unsubscribe = config2.subscribe(\n ({ data, connector, status }) => selector({\n address: data?.account,\n connector,\n status\n }),\n handleChange,\n {\n equalityFn: shallow4\n }\n );\n return unsubscribe;\n}\n\n// src/actions/accounts/watchNetwork.ts\nimport { shallow as shallow5 } from \"zustand/shallow\";\nfunction watchNetwork(callback, { selector = (x) => x } = {}) {\n const config2 = getConfig();\n const handleChange = () => callback(getNetwork());\n const unsubscribe = config2.subscribe(\n ({ data, chains }) => selector({ chainId: data?.chain?.id, chains }),\n handleChange,\n {\n equalityFn: shallow5\n }\n );\n return unsubscribe;\n}\n\n// src/actions/ens/fetchEnsAddress.ts\nimport { getAddress } from \"viem\";\nasync function fetchEnsAddress({\n chainId,\n name\n}) {\n const { normalize } = await import(\"viem/ens\");\n const publicClient = getPublicClient({ chainId });\n const address = await publicClient.getEnsAddress({\n name: normalize(name)\n });\n try {\n if (address === \"0x0000000000000000000000000000000000000000\")\n return null;\n return address ? getAddress(address) : null;\n } catch (_error) {\n return null;\n }\n}\n\n// src/actions/ens/fetchEnsAvatar.ts\nasync function fetchEnsAvatar({\n name,\n chainId\n}) {\n const { normalize } = await import(\"viem/ens\");\n const publicClient = getPublicClient({ chainId });\n const avatar = await publicClient.getEnsAvatar({ name: normalize(name) });\n return avatar;\n}\n\n// src/actions/ens/fetchEnsName.ts\nimport { getAddress as getAddress2 } from \"viem\";\nasync function fetchEnsName({\n address,\n chainId\n}) {\n const publicClient = getPublicClient({ chainId });\n return publicClient.getEnsName({\n address: getAddress2(address)\n });\n}\n\n// src/actions/ens/fetchEnsResolver.ts\nasync function fetchEnsResolver({\n chainId,\n name\n}) {\n const { normalize } = await import(\"viem/ens\");\n const publicClient = getPublicClient({ chainId });\n const resolver = await publicClient.getEnsResolver({ name: normalize(name) });\n return resolver;\n}\n\n// src/actions/network-status/fetchBlockNumber.ts\nasync function fetchBlockNumber({\n chainId\n} = {}) {\n const publicClient = getPublicClient({ chainId });\n const blockNumber = await publicClient.getBlockNumber();\n return blockNumber;\n}\n\n// src/actions/network-status/fetchFeeData.ts\nimport { formatUnits as formatUnits3, parseGwei } from \"viem\";\nasync function fetchFeeData({\n chainId,\n formatUnits: units = \"gwei\"\n} = {}) {\n const publicClient = getPublicClient({ chainId });\n const block = await publicClient.getBlock();\n let gasPrice = null;\n try {\n gasPrice = await publicClient.getGasPrice();\n } catch {\n }\n let lastBaseFeePerGas = null;\n let maxFeePerGas = null;\n let maxPriorityFeePerGas = null;\n if (block?.baseFeePerGas) {\n lastBaseFeePerGas = block.baseFeePerGas;\n maxPriorityFeePerGas = parseGwei(\"1\");\n maxFeePerGas = block.baseFeePerGas * 2n + maxPriorityFeePerGas;\n }\n const unit = getUnit(units);\n const formatted = {\n gasPrice: gasPrice ? formatUnits3(gasPrice, unit) : null,\n maxFeePerGas: maxFeePerGas ? formatUnits3(maxFeePerGas, unit) : null,\n maxPriorityFeePerGas: maxPriorityFeePerGas ? formatUnits3(maxPriorityFeePerGas, unit) : null\n };\n return {\n lastBaseFeePerGas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n formatted\n };\n}\n\n// src/actions/transactions/fetchTransaction.ts\nasync function fetchTransaction({\n chainId,\n hash\n}) {\n const publicClient = getPublicClient({ chainId });\n return publicClient.getTransaction({ hash });\n}\n\n// src/actions/transactions/prepareSendTransaction.ts\nimport { isAddress } from \"viem\";\nasync function prepareSendTransaction({\n accessList,\n account,\n chainId,\n data,\n gas: gas_,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to: to_,\n value,\n walletClient: walletClient_\n}) {\n const publicClient = getPublicClient({ chainId });\n const walletClient = walletClient_ ?? await getWalletClient({ chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (chainId)\n assertActiveChain({ chainId });\n const to = (to_ && !isAddress(to_) ? await fetchEnsAddress({ name: to_ }) : to_) || void 0;\n if (to && !isAddress(to))\n throw new Error(\"Invalid address\");\n const gas = typeof gas_ === \"undefined\" ? await publicClient.estimateGas({\n accessList,\n account: walletClient.account,\n data,\n gas: gas_ ?? void 0,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value\n }) : gas_ || void 0;\n return {\n accessList,\n account,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n mode: \"prepared\",\n nonce,\n to,\n value,\n ...chainId ? { chainId } : {}\n };\n}\n\n// src/actions/transactions/sendTransaction.ts\nasync function sendTransaction({\n accessList,\n account,\n chainId,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n mode,\n nonce,\n to,\n value\n}) {\n const walletClient = await getWalletClient({ chainId });\n if (!walletClient)\n throw new ConnectorNotFoundError();\n if (chainId)\n assertActiveChain({ chainId });\n let args;\n if (mode === \"prepared\") {\n args = {\n account,\n accessList,\n chain: null,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value\n };\n } else {\n args = await prepareSendTransaction({\n accessList,\n account,\n chainId,\n data,\n gas: gas || null,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value\n });\n }\n const hash = await walletClient.sendTransaction({\n ...args,\n chain: chainId ? { id: chainId } : null\n });\n return { hash };\n}\n\n// src/actions/transactions/waitForTransaction.ts\nimport { hexToString as hexToString3 } from \"viem\";\nasync function waitForTransaction({\n chainId,\n confirmations = 1,\n hash,\n onReplaced,\n timeout = 0\n}) {\n const publicClient = getPublicClient({ chainId });\n const receipt = await publicClient.waitForTransactionReceipt({\n hash,\n confirmations,\n onReplaced,\n timeout\n });\n if (receipt.status === \"reverted\") {\n const txn = await publicClient.getTransaction({\n hash: receipt.transactionHash\n });\n const code = await publicClient.call({\n ...txn,\n gasPrice: txn.type !== \"eip1559\" ? txn.gasPrice : void 0,\n maxFeePerGas: txn.type === \"eip1559\" ? txn.maxFeePerGas : void 0,\n maxPriorityFeePerGas: txn.type === \"eip1559\" ? txn.maxPriorityFeePerGas : void 0\n });\n const reason = hexToString3(`0x${code.substring(138)}`);\n throw new Error(reason);\n }\n return receipt;\n}\n\n// src/actions/transactions/watchPendingTransactions.ts\nimport { shallow as shallow6 } from \"zustand/shallow\";\nfunction watchPendingTransactions(args, callback) {\n let unwatch;\n const createListener = (publicClient) => {\n if (unwatch)\n unwatch();\n unwatch = publicClient.watchPendingTransactions({\n onTransactions: callback,\n poll: true\n });\n };\n const publicClient_ = getWebSocketPublicClient({ chainId: args.chainId }) ?? getPublicClient({ chainId: args.chainId });\n createListener(publicClient_);\n const config2 = getConfig();\n const unsubscribe = config2.subscribe(\n ({ publicClient, webSocketPublicClient }) => ({\n publicClient,\n webSocketPublicClient\n }),\n async ({ publicClient, webSocketPublicClient }) => {\n const publicClient_2 = webSocketPublicClient ?? publicClient;\n if (!args.chainId && publicClient_2) {\n createListener(publicClient_2);\n }\n },\n {\n equalityFn: shallow6\n }\n );\n return () => {\n unsubscribe();\n unwatch?.();\n };\n}\n\n// src/utils/assertActiveChain.ts\nfunction assertActiveChain({ chainId }) {\n const { chain: activeChain, chains } = getNetwork();\n const activeChainId = activeChain?.id;\n if (activeChainId && chainId !== activeChainId) {\n throw new ChainMismatchError({\n activeChain: chains.find((x) => x.id === activeChainId)?.name ?? `Chain ${activeChainId}`,\n targetChain: chains.find((x) => x.id === chainId)?.name ?? `Chain ${chainId}`\n });\n }\n}\n\nexport {\n configureChains,\n ChainMismatchError,\n ChainNotConfiguredError,\n ConnectorAlreadyConnectedError,\n ConfigChainsNotFound,\n SwitchChainNotSupportedError,\n ConnectorNotFoundError,\n deepEqual,\n deserialize,\n getCallParameters,\n getSendTransactionParameters,\n getUnit,\n serialize,\n noopStorage,\n createStorage,\n Config,\n createConfig,\n getConfig,\n connect,\n disconnect,\n erc20ABI,\n erc721ABI,\n erc4626ABI,\n fetchToken,\n getPublicClient,\n getWalletClient,\n getWebSocketPublicClient,\n watchPublicClient,\n watchWalletClient,\n watchWebSocketPublicClient,\n prepareWriteContract,\n getContract,\n multicall,\n readContract,\n readContracts,\n watchContractEvent,\n watchBlockNumber,\n watchMulticall,\n watchReadContract,\n watchReadContracts,\n writeContract,\n fetchBalance,\n getAccount,\n getNetwork,\n signMessage,\n signTypedData,\n switchNetwork,\n watchAccount,\n watchNetwork,\n fetchEnsAddress,\n fetchEnsAvatar,\n fetchEnsName,\n fetchEnsResolver,\n fetchBlockNumber,\n fetchFeeData,\n fetchTransaction,\n prepareSendTransaction,\n sendTransaction,\n waitForTransaction,\n watchPendingTransactions\n};\n","import { MockProvider, MockProviderOptions } from '@wagmi/connectors/mock';\nimport { Connector, ConnectorData, WalletClient } from '@wagmi/core';\nimport { createWalletClient, getAddress, Hex, http, zeroAddress } from 'viem';\nimport type { Chain } from 'viem/chains';\nimport { mainnet } from 'viem/chains';\n\nexport function normalizeChainId(chainId: string | number | bigint) {\n if (typeof chainId === 'string')\n return Number.parseInt(\n chainId,\n chainId.trim().substring(0, 2) === '0x' ? 16 : 10,\n );\n if (typeof chainId === 'bigint') return Number(chainId);\n return chainId;\n}\n\ntype MockConnectorOptions = Omit<\n MockProviderOptions,\n 'chainId' | 'walletClient'\n> & {\n chainId?: number;\n};\n\nexport class ImpersonatedConnector extends Connector<\n MockProvider,\n MockConnectorOptions\n> {\n readonly id = 'impersonated';\n readonly name = 'Impersonated';\n readonly ready = true;\n private accountAddress: Hex;\n\n #provider?: MockProvider;\n\n constructor({\n chains,\n options,\n }: {\n chains?: Chain[];\n options: MockConnectorOptions;\n }) {\n super({\n chains,\n options: {\n ...options,\n chainId: options.chainId ?? chains?.[0]?.id,\n },\n });\n this.accountAddress = zeroAddress;\n }\n\n setAccountAddress(address: Hex | undefined) {\n this.accountAddress = address || zeroAddress;\n }\n\n async connect({ chainId }: { address?: Hex; chainId?: number } = {}) {\n const provider = await this.getProvider({\n address: this.accountAddress,\n chainId,\n });\n provider.on('accountsChanged', this.onAccountsChanged);\n provider.on('chainChanged', this.onChainChanged);\n provider.on('disconnect', this.onDisconnect);\n\n this.emit('message', { type: 'connecting' });\n\n const accounts = await provider.enable();\n const account = getAddress(accounts[0] as string);\n const id = normalizeChainId(provider.chainId);\n const unsupported = this.isChainUnsupported(id);\n const data = { account, chain: { id, unsupported }, provider };\n\n if (!this.options.flags?.noSwitchChain)\n this.switchChain = this.#switchChain;\n\n return new Promise>((res) =>\n setTimeout(() => res(data), 100),\n );\n }\n\n async disconnect() {\n const provider = await this.getProvider();\n await provider.disconnect();\n\n provider.removeListener('accountsChanged', this.onAccountsChanged);\n provider.removeListener('chainChanged', this.onChainChanged);\n provider.removeListener('disconnect', this.onDisconnect);\n }\n\n async getAccount() {\n const provider = await this.getProvider();\n const accounts = await provider.getAccounts();\n const account = accounts[0];\n if (!account) throw new Error('Failed to get account');\n // return checksum address\n return getAddress(account);\n }\n\n async getChainId() {\n const provider = await this.getProvider();\n return normalizeChainId(provider.chainId);\n }\n\n async getProvider({\n address,\n chainId,\n }: { address?: Hex; chainId?: number } = {}) {\n console.log('address', address);\n if (!this.#provider || chainId)\n this.#provider = new MockProvider({\n ...this.options,\n chainId: chainId ?? this.options.chainId ?? this.chains[0]!.id,\n walletClient: createWalletClient({\n account: address || zeroAddress,\n chain: this.chains.find((chain) => chain.id === chainId) || mainnet,\n transport: http(),\n }),\n });\n return this.#provider;\n }\n\n async getWalletClient(): Promise {\n const provider = await this.getProvider();\n return provider.getWalletClient();\n }\n\n async isAuthorized() {\n try {\n const provider = await this.getProvider();\n const account = await provider.getAccounts();\n return this.options.flags?.isAuthorized ?? !!account;\n } catch {\n return false;\n }\n }\n\n async #switchChain(chainId: number) {\n const provider = await this.getProvider();\n await provider.switchChain(chainId);\n return (\n this.chains.find((x) => x.id === chainId) ?? {\n id: chainId,\n name: `Chain ${chainId}`,\n network: `${chainId}`,\n nativeCurrency: { name: 'Ether', decimals: 18, symbol: 'ETH' },\n rpcUrls: { default: { http: [''] }, public: { http: [''] } },\n }\n );\n }\n\n async watchAsset(asset: {\n address: string;\n decimals?: number;\n image?: string;\n symbol: string;\n }) {\n const provider = await this.getProvider();\n return provider.watchAsset(asset);\n }\n\n protected onAccountsChanged = (accounts: string[]) => {\n if (accounts.length === 0) this.emit('disconnect');\n else this.emit('change', { account: getAddress(accounts[0] as string) });\n };\n\n protected onChainChanged = (chainId: number | string) => {\n const id = normalizeChainId(chainId);\n const unsupported = this.isChainUnsupported(id);\n this.emit('change', { chain: { id, unsupported } });\n };\n\n protected onDisconnect = () => {\n this.emit('disconnect');\n };\n\n toJSON() {\n return '';\n }\n}\n","import {\n configureChains,\n createConfig,\n GetAccountResult,\n watchAccount,\n watchNetwork,\n} from '@wagmi/core';\nimport React, { useEffect, useState } from 'react';\nimport { Chain } from 'viem';\nimport { publicProvider } from 'wagmi/providers/public';\nimport { StoreApi, UseBoundStore } from 'zustand';\n\nimport {\n AllConnectorsInitProps,\n ConnectorType,\n initAllConnectors,\n} from '../connectors';\n\ninterface WagmiProviderProps {\n useStore: UseBoundStore<\n StoreApi<{\n changeActiveWalletAccount: (account?: GetAccountResult) => Promise;\n changeActiveWalletChain: (chain?: Chain) => Promise;\n setConnectors: (connectors: ConnectorType[]) => void;\n }>\n >;\n connectorsInitProps: AllConnectorsInitProps;\n}\n\nfunction Child({\n useStore,\n connectors,\n}: Omit & {\n connectors: ConnectorType[];\n}) {\n const { setConnectors, changeActiveWalletAccount, changeActiveWalletChain } =\n useStore();\n\n watchAccount(async (data) => {\n if (data.address) {\n await changeActiveWalletAccount(data);\n }\n });\n watchNetwork(async (data) => {\n if (data.chain?.id) {\n await changeActiveWalletChain(data.chain);\n }\n });\n\n useEffect(() => {\n if (connectors) {\n setConnectors(connectors);\n }\n }, [connectors]);\n\n return null;\n}\n\nexport function WagmiProvider({\n useStore,\n connectorsInitProps,\n}: WagmiProviderProps) {\n const [connectors] = useState(initAllConnectors(connectorsInitProps));\n const [mappedConnectors] = useState(\n connectors.map((connector) => connector),\n );\n\n const { publicClient } = configureChains(\n Object.values(connectorsInitProps.chains),\n [publicProvider()],\n );\n\n createConfig({\n autoConnect: false,\n publicClient,\n connectors,\n });\n\n return ;\n}\n","import { Draft, produce } from 'immer';\nimport { Hex, PublicClient } from 'viem';\n\nimport { StoreSlice } from '../../types/store';\nimport {\n getLocalStorageTxPool,\n setLocalStorageTxPool,\n} from '../../utils/localStorage';\nimport { EthereumAdapter } from '../adapters/EthereumAdapter';\nimport {\n GelatoAdapter,\n GelatoTx,\n GelatoTXState,\n isGelatoBaseTx,\n isGelatoBaseTxWithoutTimestamp,\n isGelatoTx,\n} from '../adapters/GelatoAdapter';\nimport { GnosisAdapter } from '../adapters/GnosisAdapter';\nimport { AdapterInterface } from '../adapters/interface';\nimport { WalletType } from '../connectors';\nimport { IWalletSlice } from './walletSlice';\n\nexport type BaseTx = EthBaseTx | GelatoBaseTx;\n\nexport type InitialTx = Hex | GelatoTx;\nexport type NewTx = { hash: Hex } | GelatoTx;\n\ntype BasicTx = {\n chainId: number;\n type: string;\n from: Hex;\n payload?: object;\n localTimestamp: number;\n timestamp?: number;\n errorMessage?: string;\n};\n\nexport type EthBaseTx = BasicTx & {\n hash: Hex;\n to: Hex;\n nonce: number;\n};\n\nexport type GelatoBaseTx = BasicTx & {\n taskId: string;\n hash?: Hex;\n gelatoStatus?: GelatoTXState;\n};\n\nexport type ClientsRecord = Record;\n\nexport type TransactionsSliceBaseType = {\n clients: ClientsRecord;\n setClient: (chainId: number, client: PublicClient) => void;\n initTxPool: () => void;\n updateEthAdapter: (gnosis: boolean) => void;\n};\n\nexport type TransactionPool = Record;\n\ntype PoolTx = T & {\n status?: number;\n pending: boolean;\n walletType: WalletType;\n};\n\nexport interface ITransactionsState {\n transactionsPool: TransactionPool>;\n transactionsIntervalsMap: Record;\n}\n\nexport interface ITransactionsActions {\n gelatoAdapter: AdapterInterface;\n ethereumAdapter: AdapterInterface;\n txStatusChangedCallback: (\n data: T & {\n status?: number;\n timestamp?: number;\n },\n ) => void;\n executeTx: (params: {\n body: () => Promise;\n params: {\n type: T['type'];\n payload: T['payload'];\n desiredChainID: number;\n };\n }) => Promise<\n T & {\n status?: number;\n pending: boolean;\n }\n >;\n addTXToPool: (\n tx:\n | Omit\n | Omit,\n activeWallet: WalletType,\n ) => TransactionPool>;\n isGelatoAvailable: boolean;\n checkIsGelatoAvailable: (chainId: number) => Promise;\n updateEthAdapter: (gnosis: boolean) => void;\n}\n\nexport type ITransactionsSlice = ITransactionsActions &\n ITransactionsState &\n TransactionsSliceBaseType;\n\nexport function createTransactionsSlice({\n txStatusChangedCallback,\n defaultClients,\n}: {\n txStatusChangedCallback: (tx: T) => void;\n defaultClients: ClientsRecord;\n}): StoreSlice<\n ITransactionsSlice,\n Pick\n> {\n return (set, get) => ({\n transactionsPool: {},\n transactionsIntervalsMap: {},\n clients: defaultClients,\n txStatusChangedCallback,\n gelatoAdapter: new GelatoAdapter(get, set), // TODO: think when to init, maybe only when working with gelato or it's available\n ethereumAdapter: new EthereumAdapter(get, set), // This might be a Gnosis Safe adapter, re-inits when wallet.type === GnosisSafe\n executeTx: async ({ body, params }) => {\n await get().checkAndSwitchNetwork(params.desiredChainID);\n const activeWallet = get().activeWallet;\n if (!activeWallet) {\n throw new Error('No wallet connected');\n }\n\n const chainId = Number(params.desiredChainID);\n\n const tx: InitialTx = await body();\n const args = {\n tx: isGelatoTx(tx) ? tx : { hash: tx },\n payload: params.payload,\n activeWallet,\n chainId,\n type: params.type,\n };\n\n return isGelatoTx(tx) // in case of gnosis safe it works in a same way\n ? get().gelatoAdapter.executeTx(args)\n : get().ethereumAdapter.executeTx(args);\n },\n\n addTXToPool: (transaction, walletType) => {\n const localTimestamp = new Date().getTime();\n if (isGelatoBaseTxWithoutTimestamp(transaction)) {\n set((state) =>\n produce(state, (draft) => {\n draft.transactionsPool[transaction.taskId] = {\n ...transaction,\n pending: true,\n walletType,\n localTimestamp,\n } as Draft<\n T & {\n pending: boolean;\n walletType: WalletType;\n localTimestamp: number;\n }\n >;\n }),\n );\n\n const txPool = get().transactionsPool;\n setLocalStorageTxPool(txPool);\n } else {\n set((state) =>\n produce(state, (draft) => {\n draft.transactionsPool[transaction.hash] = {\n ...transaction,\n pending: true,\n walletType,\n localTimestamp,\n } as Draft<\n T & {\n pending: boolean;\n walletType: WalletType;\n }\n >;\n }),\n );\n }\n const txPool = get().transactionsPool;\n setLocalStorageTxPool(txPool);\n return txPool;\n },\n\n initTxPool: () => {\n const localStorageTXPool = getLocalStorageTxPool();\n if (localStorageTXPool) {\n const transactionsPool = JSON.parse(localStorageTXPool);\n // TODO: figure out type casting from string via ZOD or similar\n set(() => ({\n transactionsPool,\n }));\n }\n Object.values(get().transactionsPool).forEach((tx) => {\n if (tx.pending) {\n if (isGelatoBaseTx(tx)) {\n get().gelatoAdapter.startTxTracking(tx.taskId);\n } else {\n if (tx.hash) {\n get().ethereumAdapter.startTxTracking(tx.hash);\n }\n }\n }\n });\n },\n\n setClient: (chainId, client) => {\n const stateClients = get().clients;\n const updatedClients = (stateClients[chainId] = client);\n set({ clients: updatedClients });\n },\n\n isGelatoAvailable: true,\n checkIsGelatoAvailable: async (chainId) => {\n try {\n const response = await fetch(`https://relay.gelato.digital/relays/v2`);\n if (!response.ok) {\n set({ isGelatoAvailable: false });\n } else {\n const listOfRelays = (await response.json()) as { relays: string[] };\n const isRelayAvailable = !!listOfRelays.relays.find(\n (id) => +id === chainId,\n );\n set({ isGelatoAvailable: isRelayAvailable });\n }\n } catch (e) {\n set({ isGelatoAvailable: false });\n console.error(e);\n }\n },\n updateEthAdapter: (gnosis: boolean) => {\n set((state) =>\n produce(state, (draft) => {\n draft.ethereumAdapter = gnosis\n ? new GnosisAdapter(get, set)\n : new EthereumAdapter(get, set);\n }),\n );\n },\n });\n}\n","import { produce } from 'immer';\nimport { GetTransactionReturnType, Hex, PublicClient } from 'viem';\n\nimport { setLocalStorageTxPool } from '../../utils/localStorage';\nimport { BaseTx, ITransactionsSlice, NewTx } from '../store/transactionsSlice';\nimport { Wallet } from '../store/walletSlice';\nimport { AdapterInterface } from './interface';\n\nexport class EthereumAdapter implements AdapterInterface {\n get: () => ITransactionsSlice;\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void;\n transactionsIntervalsMap: Record = {};\n\n constructor(\n get: () => ITransactionsSlice,\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void,\n ) {\n this.get = get;\n this.set = set;\n }\n\n executeTx = async (params: {\n tx: NewTx;\n activeWallet: Wallet;\n payload: object | undefined;\n chainId: number;\n type: T['type'];\n }): Promise => {\n const { activeWallet, chainId, type } = params;\n const tx = params.tx as GetTransactionReturnType;\n\n // ethereum tx\n const transaction = {\n chainId,\n hash: tx.hash,\n type,\n payload: params.payload,\n from: tx.from,\n to: tx.to as Hex,\n nonce: tx.nonce,\n };\n const txPool = this.get().addTXToPool(transaction, activeWallet.walletType);\n this.waitForTxReceipt(tx, tx.hash);\n return txPool[tx.hash];\n };\n startTxTracking = async (txKey: string) => {\n const retryCount = 5;\n const txData = this.get().transactionsPool[txKey];\n if (txData) {\n const client = this.get().clients[txData.chainId] as PublicClient;\n\n if (txData.hash) {\n // Find the transaction in the waiting pool\n for (let i = 0; i < retryCount; i++) {\n const tx = await client.getTransaction({ hash: txData.hash });\n // If the transaction is found, wait for the receipt\n if (tx) {\n await this.waitForTxReceipt(tx, txData.hash);\n return; // Exit the function if successful\n }\n }\n // Wait before the next retry\n await new Promise((resolve) => setTimeout(resolve, 3000));\n }\n } else {\n // TODO: no transaction in waiting pool\n }\n };\n\n private waitForTxReceipt = async (\n tx: GetTransactionReturnType,\n txHash: Hex,\n ) => {\n const chainId = tx.chainId || this.get().transactionsPool[txHash].chainId;\n const client = this.get().clients[chainId] as PublicClient;\n\n try {\n // TODO: need added onReplaced logic\n const txn = await client.waitForTransactionReceipt({ hash: tx.hash });\n this.updateTXStatus(txHash, txn.status);\n\n const updatedTX = this.get().transactionsPool[txHash];\n const txBlock = await client.getBlock({ blockNumber: txn.blockNumber });\n const timestamp = txBlock.timestamp;\n this.get().txStatusChangedCallback({\n ...updatedTX,\n timestamp,\n });\n } catch (e) {\n console.error(e);\n }\n };\n\n private updateTXStatus = (hash: string, status?: 'success' | 'reverted') => {\n this.set((state) =>\n produce(state, (draft) => {\n draft.transactionsPool[hash].status =\n status === 'success'\n ? 1\n : draft.transactionsPool[hash].pending\n ? undefined\n : 0;\n draft.transactionsPool[hash].pending = false;\n }),\n );\n setLocalStorageTxPool(this.get().transactionsPool);\n };\n}\n","import dayjs from 'dayjs';\nimport { produce } from 'immer';\nimport { GetTransactionReturnType, Hex } from 'viem';\n\nimport { SafeTransactionServiceUrls } from '../../utils/constants';\nimport { setLocalStorageTxPool } from '../../utils/localStorage';\nimport {\n BaseTx,\n EthBaseTx,\n ITransactionsSlice,\n NewTx,\n} from '../store/transactionsSlice';\nimport { Wallet } from '../store/walletSlice';\nimport { AdapterInterface } from './interface';\n\nexport type GnosisTxStatusResponse = {\n transactionHash: string;\n safeTxHash: string;\n isExecuted: boolean;\n isSuccessful: boolean | null;\n executionDate: string | null;\n submissionDate: string | null;\n modified: string;\n nonce: number;\n};\n\nexport class GnosisAdapter implements AdapterInterface {\n get: () => ITransactionsSlice;\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void;\n transactionsIntervalsMap: Record = {};\n\n constructor(\n get: () => ITransactionsSlice,\n set: (fn: (state: ITransactionsSlice) => ITransactionsSlice) => void,\n ) {\n this.get = get;\n this.set = set;\n }\n\n executeTx = async (params: {\n tx: NewTx;\n activeWallet: Wallet;\n payload: object | undefined;\n chainId: number;\n type: T['type'];\n }): Promise => {\n const { activeWallet, chainId, type } = params;\n const tx = params.tx as GetTransactionReturnType;\n // ethereum tx\n const transaction = {\n chainId,\n hash: tx.hash,\n type,\n payload: params.payload,\n from: tx.from,\n to: tx.to as Hex,\n nonce: tx.nonce,\n };\n const txPool = this.get().addTXToPool(transaction, activeWallet.walletType);\n this.startTxTracking(tx.hash);\n return txPool[tx.hash];\n };\n\n startTxTracking = async (txKey: string) => {\n const tx = this.get().transactionsPool[txKey];\n const isPending = tx.pending;\n if (!isPending) {\n return;\n }\n this.stopPollingGnosisTXStatus(txKey);\n\n const newGnosisInterval = setInterval(() => {\n this.fetchGnosisTxStatus(txKey);\n // TODO: maybe change timeout or even stop tracking after some time (day/week)\n }, 10000);\n\n this.transactionsIntervalsMap[txKey] = Number(newGnosisInterval);\n };\n\n private fetchGnosisTxStatus = async (txKey: string) => {\n const tx = this.get().transactionsPool[txKey];\n const response = await fetch(\n `${\n SafeTransactionServiceUrls[tx.chainId]\n }/multisig-transactions/${txKey}/`,\n );\n if (!response.ok) {\n // TODO: handle error if need, for now just skipping and do nothing with failed response\n } else {\n const gnosisStatus = (await response.json()) as GnosisTxStatusResponse;\n const gnosisStatusModified = dayjs(gnosisStatus.modified);\n const currentTime = dayjs();\n // check if more than a day passed to stop polling\n const daysPassed = currentTime.diff(gnosisStatusModified, 'day');\n if (daysPassed >= 1) {\n this.updateGnosisTxStatus(txKey, gnosisStatus, true);\n this.stopPollingGnosisTXStatus(txKey);\n this.get().txStatusChangedCallback(tx);\n return;\n }\n\n const isPending = !gnosisStatus.isExecuted;\n this.updateGnosisTxStatus(txKey, gnosisStatus);\n if (!isPending) {\n this.stopPollingGnosisTXStatus(txKey);\n this.get().txStatusChangedCallback(tx);\n }\n }\n };\n\n private stopPollingGnosisTXStatus = (txKey: string) => {\n const currentInterval = this.transactionsIntervalsMap[txKey];\n clearInterval(currentInterval);\n this.transactionsIntervalsMap[txKey] = undefined;\n };\n\n private updateGnosisTxStatus = (\n txKey: string,\n statusResponse: GnosisTxStatusResponse,\n forceStopped?: boolean,\n ) => {\n this.set((state) =>\n produce(state, (draft) => {\n const tx = draft.transactionsPool[txKey] as EthBaseTx & {\n pending: boolean;\n status?: number;\n };\n tx.status = forceStopped ? 0 : +!!statusResponse.isSuccessful; // turns boolean | null to 0 or 1\n tx.pending = forceStopped ? false : !statusResponse.isExecuted;\n tx.nonce = statusResponse.nonce;\n }),\n );\n setLocalStorageTxPool(this.get().transactionsPool);\n };\n}\n","import {\n connect,\n disconnect,\n getAccount,\n GetAccountResult,\n getNetwork,\n getPublicClient,\n getWalletClient,\n} from '@wagmi/core';\nimport { produce } from 'immer';\nimport { Chain, Hex, PublicClient, WalletClient } from 'viem';\n\nimport { StoreSlice } from '../../types/store';\nimport {\n clearWalletConnectV2LocalStorage,\n clearWalletLinkLocalStorage,\n deleteLocalStorageWallet,\n LocalStorageKeys,\n setLocalStorageWallet,\n} from '../../utils/localStorage';\nimport { ConnectorType, getConnectorName, WalletType } from '../connectors';\nimport { ImpersonatedConnector } from '../connectors/ImpersonatedConnector';\nimport { TransactionsSliceBaseType } from './transactionsSlice';\n\nexport interface Wallet {\n walletType: WalletType;\n address: Hex;\n chain?: Chain;\n client: PublicClient;\n walletClient: WalletClient;\n // isActive is added, because Wallet can be connected but not active, i.e. wrong network\n isActive: boolean;\n // isContractAddress is added, to check if wallet address is contract\n isContractAddress: boolean;\n}\n\nexport type IWalletSlice = {\n isContractWalletRecord: Record;\n activeWallet?: Wallet;\n setActiveWallet: (\n wallet: Omit,\n ) => Promise;\n isActiveWalletSetting: boolean;\n connectWallet: (walletType: WalletType, chainId?: number) => Promise;\n disconnectActiveWallet: () => Promise;\n walletActivating: boolean;\n walletConnectionError: string;\n resetWalletConnectionError: () => void;\n initDefaultWallet: () => Promise;\n changeActiveWalletAccount: (account?: GetAccountResult) => Promise;\n isActiveWalletAccountChanging: boolean;\n changeActiveWalletChain: (chain?: Chain) => Promise;\n isActiveWalletChainChanging: boolean;\n checkAndSwitchNetwork: (chainId?: number) => Promise;\n connectors: ConnectorType[];\n setConnectors: (connectors: ConnectorType[]) => void;\n _impersonatedAddress?: Hex;\n setImpersonatedAddress: (address: Hex) => void;\n checkIsContractWallet: (\n wallet: Omit,\n ) => Promise;\n};\n\nexport function createWalletSlice({\n walletConnected,\n}: {\n walletConnected: (wallet: Wallet) => void;\n}): StoreSlice {\n return (set, get) => ({\n isContractWalletRecord: {},\n walletActivating: false,\n walletConnectionError: '',\n connectors: [],\n setConnectors: async (connectors) => {\n if (get().connectors.length !== connectors.length) {\n set(() => ({ connectors }));\n await get().initDefaultWallet();\n get().initTxPool();\n }\n },\n initDefaultWallet: async () => {\n const lastConnectedWallet = localStorage.getItem(\n LocalStorageKeys.LastConnectedWallet,\n ) as WalletType | undefined;\n\n if (lastConnectedWallet) {\n await get().connectWallet(lastConnectedWallet);\n }\n },\n\n setActiveWallet: async (wallet) => {\n if (wallet.isActive) {\n if (wallet.chain) {\n set({ isActiveWalletSetting: true });\n const client = getPublicClient({ chainId: wallet.chain.id });\n const walletClient = await getWalletClient({\n chainId: wallet.chain.id,\n });\n\n if (client && walletClient) {\n const walletWithClients = {\n ...wallet,\n walletClient,\n client,\n };\n\n const isContractAddress =\n await get().checkIsContractWallet(walletWithClients);\n const activeWallet = { ...walletWithClients, isContractAddress };\n\n set({ activeWallet });\n walletConnected(activeWallet);\n set({ isActiveWalletSetting: false });\n }\n }\n }\n },\n isActiveWalletSetting: false,\n\n connectWallet: async (walletType, chainId) => {\n clearWalletLinkLocalStorage();\n clearWalletConnectV2LocalStorage();\n\n if (get().activeWallet?.walletType !== walletType) {\n await get().disconnectActiveWallet();\n }\n\n set({ walletActivating: true });\n set({ walletConnectionError: '' });\n\n const connector = get().connectors.find(\n (connector) => getConnectorName(connector) === walletType,\n );\n\n try {\n if (connector) {\n if (connector instanceof ImpersonatedConnector) {\n connector.setAccountAddress(get()._impersonatedAddress);\n await connect({ connector, chainId });\n } else {\n await connect({ connector });\n }\n\n setLocalStorageWallet(walletType);\n get().updateEthAdapter(walletType === 'GnosisSafe');\n\n const account = getAccount();\n const network = getNetwork();\n if (\n account &&\n account.isConnected &&\n account.address &&\n network.chain\n ) {\n await get().setActiveWallet({\n walletType,\n address: account.address,\n chain: network.chain,\n isActive: account.isConnected,\n isContractAddress: false,\n });\n }\n }\n } catch (e) {\n if (e instanceof Error) {\n let errorMessage = e.message ? e.message.toString() : e.toString();\n set({\n walletConnectionError: errorMessage,\n });\n }\n console.error(e);\n }\n set({ walletActivating: false });\n },\n checkAndSwitchNetwork: async (chainId) => {\n const activeWallet = get().activeWallet;\n if (\n chainId &&\n activeWallet &&\n activeWallet.chain?.id &&\n activeWallet.chain.id !== chainId\n ) {\n set({ isActiveWalletSetting: true });\n await activeWallet.walletClient.switchChain({\n id: chainId,\n });\n await new Promise((resolve) => {\n function loop() {\n if (!get().isActiveWalletSetting) {\n return resolve(() =>\n console.info('Chain for wallet client changed'),\n );\n }\n setTimeout(loop, 10);\n }\n loop();\n });\n }\n },\n disconnectActiveWallet: async () => {\n await disconnect();\n set({ activeWallet: undefined });\n deleteLocalStorageWallet();\n clearWalletLinkLocalStorage();\n clearWalletConnectV2LocalStorage();\n },\n\n checkIsContractWallet: async (wallet) => {\n const address = wallet.address;\n const walletRecord = get().isContractWalletRecord[address];\n if (walletRecord !== undefined) {\n return walletRecord;\n }\n const codeOfWalletAddress = await wallet.client.getBytecode({\n address: wallet.address,\n });\n const isContractWallet = !!codeOfWalletAddress;\n set((state) =>\n produce(state, (draft) => {\n draft.isContractWalletRecord[address] = isContractWallet;\n }),\n );\n return isContractWallet;\n },\n\n changeActiveWalletAccount: async (account) => {\n const activeWallet = get().activeWallet;\n if (\n account &&\n account.address &&\n activeWallet &&\n activeWallet.isActive &&\n activeWallet.address !== account.address &&\n !get().isActiveWalletAccountChanging\n ) {\n set({ isActiveWalletAccountChanging: true });\n await get().setActiveWallet({\n walletType: activeWallet.walletType,\n address: account.address,\n isActive: activeWallet.isActive,\n isContractAddress: activeWallet.isContractAddress,\n chain: activeWallet.chain,\n });\n set({ isActiveWalletAccountChanging: false });\n }\n },\n isActiveWalletAccountChanging: false,\n changeActiveWalletChain: async (chain) => {\n const activeWallet = get().activeWallet;\n if (\n chain !== undefined &&\n activeWallet &&\n activeWallet.isActive &&\n activeWallet.chain &&\n activeWallet.chain.id !== chain.id &&\n !get().isActiveWalletChainChanging\n ) {\n set({ isActiveWalletChainChanging: true });\n await get().setActiveWallet({\n walletType: activeWallet.walletType,\n address: activeWallet.address,\n isActive: activeWallet.isActive,\n isContractAddress: activeWallet.isContractAddress,\n chain: chain,\n });\n set({ isActiveWalletChainChanging: false });\n }\n },\n isActiveWalletChainChanging: false,\n\n setImpersonatedAddress: (address) => {\n set({ _impersonatedAddress: address });\n },\n resetWalletConnectionError: () => {\n set({ walletConnect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A,IACF;AAAA,IACA,+BAA+B;AAAA,IAC/B,yBAAyB,OAAO,UAAU;AACxC,YAAM,eAAe,IAAI,EAAE;AAC3B,UACE,UAAU,UACV,gBACA,aAAa,YACb,aAAa,SACb,aAAa,MAAM,OAAO,MAAM,MAChC,CAAC,IAAI,EAAE,6BACP;AACA,YAAI,EAAE,6BAA6B,KAAK,CAAC;AACzC,cAAM,IAAI,EAAE,gBAAgB;AAAA,UAC1B,YAAY,aAAa;AAAA,UACzB,SAAS,aAAa;AAAA,UACtB,UAAU,aAAa;AAAA,UACvB,mBAAmB,aAAa;AAAA,UAChC;AAAA,QACF,CAAC;AACD,YAAI,EAAE,6BAA6B,MAAM,CAAC;AAAA,MAC5C;AAAA,IACF;AAAA,IACA,6BAA6B;AAAA,IAE7B,wBAAwB,CAAC,YAAY;AACnC,UAAI,EAAE,sBAAsB,QAAQ,CAAC;AAAA,IACvC;AAAA,IACA,4BAA4B,MAAM;AAChC,UAAI,EAAE,uBAAuB,GAAG,CAAC;AAAA,IACnC;AAAA,EACF;AACF;","names":["EventEmitter","LocalStorageKeys","goerli","mainnet","avalanche","goerli","mainnet","polygon","InjectedConnector","goerli","mainnet","EventEmitter","mainnet","goerli","import_eventemitter3","EventEmitter","UserRejectedRequestError","getAddress","_provider","provider","__accessCheck","__privateGet","__privateAdd","__privateSet","__privateMethod","createPublicClient","http","getAddress","getAddress2","createPublicClient","http","__privateAdd","status","__privateSet","__privateMethod","__privateGet","status","status","createWalletClient","getAddress","http","mainnet","normalizeChainId","InjectedConnector","coinbase","useEffect","useState","useEffect","useState","produce","produce","status","produce","produce","produce","produce","txPool","produce","connector","produce"]} \ No newline at end of file diff --git a/package.json b/package.json index bb84a22..053599b 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "url": "https://github.com/Tima0203" } ], - "version": "0.2.27", + "version": "0.2.28", "license": "MIT", "files": [ "dist", diff --git a/src/web3/store/walletSlice.ts b/src/web3/store/walletSlice.ts index a41d172..6d28d65 100644 --- a/src/web3/store/walletSlice.ts +++ b/src/web3/store/walletSlice.ts @@ -1,5 +1,3 @@ -// TODO: need add logic for mock connector - import { connect, disconnect, @@ -43,7 +41,7 @@ export type IWalletSlice = { wallet: Omit, ) => Promise; isActiveWalletSetting: boolean; - connectWallet: (walletType: WalletType) => Promise; + connectWallet: (walletType: WalletType, chainId?: number) => Promise; disconnectActiveWallet: () => Promise; walletActivating: boolean; walletConnectionError: string; @@ -119,7 +117,7 @@ export function createWalletSlice({ }, isActiveWalletSetting: false, - connectWallet: async (walletType) => { + connectWallet: async (walletType, chainId) => { clearWalletLinkLocalStorage(); clearWalletConnectV2LocalStorage(); @@ -138,7 +136,7 @@ export function createWalletSlice({ if (connector) { if (connector instanceof ImpersonatedConnector) { connector.setAccountAddress(get()._impersonatedAddress); - await connect({ connector }); + await connect({ connector, chainId }); } else { await connect({ connector }); }