diff --git a/components/WalletProviders/TronProvider.tsx b/components/WalletProviders/TronProvider.tsx index 24c25a041..31f7d3822 100644 --- a/components/WalletProviders/TronProvider.tsx +++ b/components/WalletProviders/TronProvider.tsx @@ -13,22 +13,28 @@ export default function TronProvider({ children }: { children: React.ReactNode } } const [adapters, setAdapters] = useState([]); useEffect(() => { - import('@tronweb3/tronwallet-adapters').then((res) => { + import('../../lib/wallets/tron/connectors').then((res) => { const { BitKeepAdapter, OkxWalletAdapter, TokenPocketAdapter, TronLinkAdapter, - LedgerAdapter, + // LedgerAdapter, } = res; const tronLinkAdapter = new TronLinkAdapter(); - const ledger = new LedgerAdapter({ - accountNumber: 2, - }); + // const ledger = new LedgerAdapter({ + // accountNumber: 2, + // }); const bitKeepAdapter = new BitKeepAdapter(); const tokenPocketAdapter = new TokenPocketAdapter(); const okxwalletAdapter = new OkxWalletAdapter(); - setAdapters([tronLinkAdapter, bitKeepAdapter, tokenPocketAdapter, okxwalletAdapter, ledger]) + setAdapters([ + tronLinkAdapter, + bitKeepAdapter, + tokenPocketAdapter, + okxwalletAdapter, + // ledger + ]) }); }, [setAdapters]) diff --git a/components/WalletProviders/index.tsx b/components/WalletProviders/index.tsx index cef50d2d7..772e3c5e7 100644 --- a/components/WalletProviders/index.tsx +++ b/components/WalletProviders/index.tsx @@ -4,32 +4,22 @@ import SolanaProvider from "./SolanaProvider" import { ThemeData } from "../../Models/Theme" import Wagmi from "./Wagmi"; import StarknetProvider from "./StarknetProvider"; -import dynamic from "next/dynamic"; import { ImtblPassportProvider } from "./ImtblPassportProvider"; - -const TronProvider = dynamic(() => import("./TronProvider").then((comp) => comp.default), { - loading: () => null -}) +import TronProvider from "./TronProvider"; const WalletsProviders: FC<{ children: JSX.Element | JSX.Element[], basePath: string, themeData: ThemeData, appName: string | undefined }> = ({ children, basePath, themeData, appName }) => { return ( - - - - - { - TronProvider ? - - {children} - - : - children - } - - - + + + + + {children} + + + + ) diff --git a/lib/wallets/tron/connectors/bitkeep.ts b/lib/wallets/tron/connectors/bitkeep.ts new file mode 100644 index 000000000..f9637b0f2 --- /dev/null +++ b/lib/wallets/tron/connectors/bitkeep.ts @@ -0,0 +1,348 @@ +import { + Adapter, + AdapterState, + isInBrowser, + WalletReadyState, + WalletSignMessageError, + WalletNotFoundError, + WalletDisconnectedError, + WalletSignTransactionError, + WalletConnectionError, + WalletGetNetworkError, + isInMobileBrowser, +} from '@tronweb3/tronwallet-abstract-adapter'; +import { getNetworkInfoByTronWeb } from '@tronweb3/tronwallet-adapter-tronlink'; +import { WalletInfo, TronLinkAdapter } from '@bitget-wallet/web3-sdk'; +import type { TronLinkWallet } from '@tronweb3/tronwallet-adapter-tronlink'; +import type { + Transaction, + SignedTransaction, + AdapterName, + BaseAdapterConfig, + Network, +} from '@tronweb3/tronwallet-abstract-adapter'; + +export function supportBitgetWallet() { + return !!window.tronLink && (window as any).isBitKeep; +} + +export function openBitgetWallet() { + if (isInMobileBrowser() && !supportBitgetWallet()) { + const { origin, pathname, search, hash } = window.location; + const url = origin + pathname + search + hash; + location.href = `https://bkcode.vip?action=dapp&url=${encodeURIComponent(url)}`; + return true; + } + return false; +} + +export interface BitKeepAdapterConfig extends BaseAdapterConfig { + /** + * Timeout in millisecond for checking if Bitget Wallet is supported. + * Default is 2 * 1000ms + */ + checkTimeout?: number; + /** + * Set if open Wallet's website url when wallet is not installed. + * Default is true. + */ + openUrlWhenWalletNotFound?: boolean; + /** + * Set if open Bitget Wallet app using DeepLink. + * Default is true. + */ + openAppWithDeeplink?: boolean; +} + +export const BitgetWalletAdapterName = WalletInfo?.name as AdapterName<'Bitget Wallet'>; + +export class BitKeepAdapter extends Adapter { + name = BitgetWalletAdapterName; + url = WalletInfo?.homepage; + icon = WalletInfo?.logolist?.base64; + config: Required; + private _readyState: WalletReadyState = WalletReadyState.Loading; + private _state: AdapterState = AdapterState.Loading; + private _connecting: boolean; + private _wallet: TronLinkWallet | null; + private _address: string | null; + + constructor(config: BitKeepAdapterConfig = {}) { + super(); + const { checkTimeout = 2 * 1000, openUrlWhenWalletNotFound = true, openAppWithDeeplink = true } = config; + if (typeof checkTimeout !== 'number') { + throw new Error('[BitKeepAdapter] config.checkTimeout should be a number'); + } + this.config = { + checkTimeout, + openUrlWhenWalletNotFound, + openAppWithDeeplink, + }; + this._connecting = false; + this._wallet = null; + this._address = null; + + if (!isInBrowser()) { + this._readyState = WalletReadyState.NotFound; + this.setState(AdapterState.NotFound); + return; + } + if (supportBitgetWallet()) { + this._readyState = WalletReadyState.Found; + this._updateWallet(); + } else { + this._checkWallet().then(() => { + if (this.connected) { + this.emit('connect', this.address || ''); + } + }); + } + } + + get address() { + return this._address; + } + + get state() { + return this._state; + } + get readyState() { + return this._readyState; + } + + get connecting() { + return this._connecting; + } + + /** + * Get network information. + * @returns {Network} Current network information. + */ + async network(): Promise { + try { + await this._checkWallet(); + if (this.state !== AdapterState.Connected) throw new WalletDisconnectedError(); + const wallet = this._wallet; + if (!wallet || !wallet.tronWeb) throw new WalletDisconnectedError(); + try { + return await getNetworkInfoByTronWeb(wallet.tronWeb); + } catch (e: any) { + throw new WalletGetNetworkError(e?.message, e); + } + } catch (e: any) { + this.emit('error', e); + throw e; + } + } + + async connect(): Promise { + try { + this.checkIfOpenApp(); + if (this.connected || this.connecting) return; + await this._checkWallet(); + if (this.readyState === WalletReadyState.NotFound) { + if (this.config.openUrlWhenWalletNotFound !== false && isInBrowser()) { + window.open(this.url, '_blank'); + } + throw new WalletNotFoundError(); + } + const wallet = this._wallet as TronLinkWallet; + if (!isInMobileBrowser()) { + if (!wallet) return; + this._connecting = true; + try { + await wallet.request({ method: 'tron_requestAccounts' }); + } catch (e: any) { + throw new WalletConnectionError(e.message); + } + } + const address = + wallet.tronWeb.defaultAddress?.base58 || window.bitkeep?.tronWeb?.defaultAddress?.base58 || ''; + this.setAddress(address); + this.setState(AdapterState.Connected); + this.emit('connect', this.address || ''); + } catch (error: any) { + this.emit('error', error); + throw error; + } finally { + this._connecting = false; + } + } + + async disconnect(): Promise { + if (this.state !== AdapterState.Connected) { + return; + } + this.setAddress(null); + this.setState(AdapterState.Disconnect); + this.emit('disconnect'); + } + + async signTransaction(transaction: Transaction, privateKey?: string): Promise { + try { + const wallet = await this.checkAndGetWallet(); + + try { + return await wallet.tronWeb.trx.sign(transaction, privateKey); + } catch (error: any) { + if (error instanceof Error) { + throw new WalletSignTransactionError(error.message, error); + } else { + throw new WalletSignTransactionError(error, new Error(error)); + } + } + } catch (error: any) { + this.emit('error', error); + throw error; + } + } + + async multiSign( + transaction: Transaction, + privateKey?: string | false, + permissionId?: number + ): Promise { + try { + const wallet = await this.checkAndGetWallet(); + try { + return await wallet.tronWeb.trx.multiSign(transaction, privateKey, permissionId); + } catch (error: any) { + if (error instanceof Error) { + throw new WalletSignTransactionError(error.message, error); + } else { + throw new WalletSignTransactionError(error, new Error(error)); + } + } + } catch (error: any) { + this.emit('error', error); + throw error; + } + } + + async signMessage(message: string, privateKey?: string): Promise { + try { + const wallet = await this.checkAndGetWallet(); + try { + return await wallet.tronWeb.trx.signMessageV2(message, privateKey); + } catch (error: any) { + if (error instanceof Error) { + throw new WalletSignMessageError(error.message, error); + } else { + throw new WalletSignMessageError(error, new Error(error)); + } + } + } catch (error: any) { + this.emit('error', error); + throw error; + } + } + + private async checkAndGetWallet() { + this.checkIfOpenApp(); + await this._checkWallet(); + if (!this.connected) throw new WalletDisconnectedError(); + const wallet = this._wallet; + if (!wallet || !wallet.tronWeb) throw new WalletDisconnectedError(); + return wallet as TronLinkWallet; + } + + private checkReadyInterval: ReturnType | null = null; + private checkForWalletReady() { + if (this.checkReadyInterval) { + return; + } + let times = 0; + const maxTimes = Math.floor(this.config.checkTimeout / 200); + const check = async () => { + if (this._wallet && this._wallet.ready) { + this.checkReadyInterval && clearInterval(this.checkReadyInterval); + this.checkReadyInterval = null; + await this._updateWallet(); + this.emit('connect', this.address || ''); + } else if (times > maxTimes) { + this.checkReadyInterval && clearInterval(this.checkReadyInterval); + this.checkReadyInterval = null; + } else { + times++; + } + }; + this.checkReadyInterval = setInterval(check, 200); + } + + private _checkPromise: Promise | null = null; + /** + * check if wallet exists by interval, the promise only resolve when wallet detected or timeout + * @returns if wallet exists + */ + private _checkWallet(): Promise { + if (this.readyState === WalletReadyState.Found) { + return Promise.resolve(true); + } + if (this._checkPromise) { + return this._checkPromise; + } + const interval = 100; + const maxTimes = Math.floor(this.config.checkTimeout / interval); + let times = 0, + timer: ReturnType; + this._checkPromise = new Promise((resolve) => { + const check = () => { + times++; + const isSupport = supportBitgetWallet(); + if (isSupport || times > maxTimes) { + timer && clearInterval(timer); + this._readyState = isSupport ? WalletReadyState.Found : WalletReadyState.NotFound; + this._updateWallet(); + this.emit('readyStateChanged', this.readyState); + resolve(isSupport); + } + }; + timer = setInterval(check, interval); + check(); + }); + return this._checkPromise; + } + + private checkIfOpenApp() { + if (this.config.openAppWithDeeplink === false) { + return; + } + if (openBitgetWallet()) { + throw new WalletNotFoundError(); + } + } + + private _updateWallet = async () => { + let state = this.state; + let address = this.address; + if (supportBitgetWallet()) { + const adapter = new TronLinkAdapter(); + this._wallet = + ((await adapter?.getProvider().tronLink) as unknown as TronLinkWallet) || + (window.bitkeep?.tronLink as unknown as TronLinkWallet); + address = this._wallet.tronWeb.defaultAddress?.base58 || null; + state = this._wallet.ready ? AdapterState.Connected : AdapterState.Disconnect; + if (!this._wallet.ready) { + this.checkForWalletReady(); + } + } else { + this._wallet = null; + address = null; + state = AdapterState.NotFound; + } + this.setAddress(address); + this.setState(state); + }; + + private setAddress(address: string | null) { + this._address = address; + } + + private setState(state: AdapterState) { + const preState = this.state; + if (state !== preState) { + this._state = state; + this.emit('stateChanged', state); + } + } +} diff --git a/lib/wallets/tron/connectors/index.ts b/lib/wallets/tron/connectors/index.ts new file mode 100644 index 000000000..5ad26253e --- /dev/null +++ b/lib/wallets/tron/connectors/index.ts @@ -0,0 +1,4 @@ +export * from './bitkeep'; +export * from './okxWallet'; +export * from './tokenPocket'; +export * from '@tronweb3/tronwallet-adapter-tronlink'; \ No newline at end of file diff --git a/lib/wallets/tron/connectors/okxWallet.ts b/lib/wallets/tron/connectors/okxWallet.ts new file mode 100644 index 000000000..fc7202d85 --- /dev/null +++ b/lib/wallets/tron/connectors/okxWallet.ts @@ -0,0 +1,392 @@ +import { + Adapter, + AdapterState, + isInBrowser, + WalletReadyState, + WalletSignMessageError, + WalletNotFoundError, + WalletDisconnectedError, + WalletConnectionError, + WalletSignTransactionError, + WalletGetNetworkError, + isInMobileBrowser, +} from '@tronweb3/tronwallet-abstract-adapter'; +import type { + Transaction, + SignedTransaction, + AdapterName, + BaseAdapterConfig, + Network, +} from '@tronweb3/tronwallet-abstract-adapter'; +import type { + AccountsChangedEventData, + TronLinkMessageEvent, + TronLinkWallet, +} from '@tronweb3/tronwallet-adapter-tronlink'; +import { getNetworkInfoByTronWeb } from '@tronweb3/tronwallet-adapter-tronlink'; + +export function supportOkxWallet() { + return !!(window.okxwallet && window.okxwallet.tronLink); +} + +export const isOKApp = /OKApp/i.test(navigator.userAgent); + +export function openOkxWallet() { + if (!isOKApp && isInMobileBrowser()) { + window.location.href = 'okx://wallet/dapp/url?dappUrl=' + encodeURIComponent(window.location.href); + return true; + } + return false; +} + +declare global { + interface Window { + okxwallet?: { + tronLink: TronLinkWallet; + }; + } +} +export interface OkxWalletAdapterConfig extends BaseAdapterConfig { + /** + * Timeout in millisecond for checking if OkxWallet wallet exists. + * Default is 2 * 1000ms + */ + checkTimeout?: number; + /** + * Set if open OkxWallet app using DeepLink. + * Default is true. + */ + openAppWithDeeplink?: boolean; +} + +export const OkxWalletAdapterName = 'OKX Wallet' as AdapterName<'OKX Wallet'>; + +export class OkxWalletAdapter extends Adapter { + name = OkxWalletAdapterName; + url = 'https://okx.com'; + icon = + 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnL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DI0LjM0NDUgMjQuMTAyNSAyNC42NDY2VjMxLjc1NzVDMjQuMTAyNSAzMi4wNTk2IDI0LjM0NzQgMzIuMzA0NSAyNC42NDk1IDMyLjMwNDVIMzEuNzYwNEMzMi4wNjI1IDMyLjMwNDUgMzIuMzA3NCAzMi4wNTk2IDMyLjMwNzQgMzEuNzU3NVYyNC42NDY2QzMyLjMwNzQgMjQuMzQ0NSAzMi4wNjI1IDI0LjA5OTYgMzEuNzYwNCAyNC4wOTk2WiIgZmlsbD0id2hpdGUiLz4KPHBhdGggZD0iTTI0LjY0OTUgMjQuNTk5NkgzMS43NjA0QzMxLjc4NjQgMjQuNTk5NiAzMS44MDc0IDI0LjYyMDYgMzEuODA3NCAyNC42NDY2VjMxLjc1NzVDMzEuODA3NCAzMS43ODM0IDMxLjc4NjQgMzEuODA0NSAzMS43NjA0IDMxLjgwNDVIMjQuNjQ5NUMyNC42MjM2IDMxLjgwNDUgMjQuNjAyNSAzMS43ODM0IDI0LjYwMjUgMzEuNzU3NVYyNC42NDY2QzI0LjYwMjUgMjQuNjIwNiAyNC42MjM2IDI0LjU5OTYgMjQuNjQ5NSAyNC41OTk2WiIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLW9wYWNpdHk9IjAuMTUiLz4KPC9zdmc+Cg=='; + + config: Required; + private _readyState: WalletReadyState = isInBrowser() ? WalletReadyState.Loading : WalletReadyState.NotFound; + private _state: AdapterState = AdapterState.Loading; + private _connecting: boolean; + private _wallet: TronLinkWallet | null; + private _address: string | null; + + constructor(config: OkxWalletAdapterConfig = {}) { + super(); + const { checkTimeout = 2 * 1000, openUrlWhenWalletNotFound = true, openAppWithDeeplink = true } = config; + if (typeof checkTimeout !== 'number') { + throw new Error('[OkxWalletAdapter] config.checkTimeout should be a number'); + } + this.config = { + checkTimeout, + openAppWithDeeplink, + openUrlWhenWalletNotFound, + }; + this._connecting = false; + this._wallet = null; + this._address = null; + + if (!isInBrowser()) { + this._readyState = WalletReadyState.NotFound; + this.setState(AdapterState.NotFound); + return; + } + if (supportOkxWallet()) { + this._readyState = WalletReadyState.Found; + this._updateWallet(); + } else { + this._checkWallet().then(() => { + if (this.connected) { + this.emit('connect', this.address || ''); + } + }); + } + } + + get address() { + return this._address; + } + + get state() { + return this._state; + } + get readyState() { + return this._readyState; + } + + get connecting() { + return this._connecting; + } + + /** + * Get network information used by OkxWallet. + * @returns {Network} Current network information. + */ + async network(): Promise { + try { + await this._checkWallet(); + if (this.state !== AdapterState.Connected) throw new WalletDisconnectedError(); + const wallet = this._wallet; + if (!wallet || !wallet.tronWeb) throw new WalletDisconnectedError(); + try { + return await getNetworkInfoByTronWeb(wallet.tronWeb); + } catch (e: any) { + throw new WalletGetNetworkError(e?.message, e); + } + } catch (e: any) { + this.emit('error', e); + throw e; + } + } + + async connect(): Promise { + try { + this.checkIfOpenOkxWallet(); + if (this.connected || this.connecting) return; + await this._checkWallet(); + if (this.state === AdapterState.NotFound) { + if (this.config.openUrlWhenWalletNotFound !== false && isInBrowser()) { + window.open(this.url, '_blank'); + } + throw new WalletNotFoundError(); + } + if (!this._wallet) return; + this._connecting = true; + const wallet = this._wallet as TronLinkWallet; + try { + const res = await wallet.request({ method: 'tron_requestAccounts' }); + if (!res) { + throw new WalletConnectionError('Request connect error.'); + } + if (res.code === 4000) { + throw new WalletConnectionError( + 'The same DApp has already initiated a request to connect to OkxWallet, and the pop-up window has not been closed.' + ); + } + if (res.code === 4001) { + throw new WalletConnectionError('The user rejected connection.'); + } + } catch (error: any) { + throw new WalletConnectionError(error?.message, error); + } + + const address = wallet.tronWeb.defaultAddress?.base58 || ''; + this.setAddress(address); + this.setState(AdapterState.Connected); + this._listenEvent(); + this.connected && this.emit('connect', this.address || ''); + } catch (error: any) { + this.emit('error', error); + throw error; + } finally { + this._connecting = false; + } + } + + async disconnect(): Promise { + this._stopListenEvent(); + if (this.state !== AdapterState.Connected) { + return; + } + this.setAddress(null); + this.setState(AdapterState.Disconnect); + this.emit('disconnect'); + } + + async signTransaction(transaction: Transaction, privateKey?: string): Promise { + try { + const wallet = await this.checkAndGetWallet(); + + try { + return await wallet.tronWeb.trx.sign(transaction, privateKey); + } catch (error: any) { + if (error instanceof Error) { + throw new WalletSignTransactionError(error.message, error); + } else { + throw new WalletSignTransactionError(error, new Error(error)); + } + } + } catch (error: any) { + this.emit('error', error); + throw error; + } + } + + async multiSign( + transaction: Transaction, + privateKey?: string | false, + permissionId?: number + ): Promise { + try { + const wallet = await this.checkAndGetWallet(); + + try { + return await wallet.tronWeb.trx.multiSign(transaction, privateKey, permissionId); + } catch (error: any) { + if (error instanceof Error) { + throw new WalletSignTransactionError(error.message, error); + } else { + throw new WalletSignTransactionError(error, new Error(error)); + } + } + } catch (error: any) { + this.emit('error', error); + throw error; + } + } + + async signMessage(message: string, privateKey?: string): Promise { + try { + const wallet = await this.checkAndGetWallet(); + try { + return await wallet.tronWeb.trx.signMessageV2(message, privateKey); + } catch (error: any) { + if (error instanceof Error) { + throw new WalletSignMessageError(error.message, error); + } else { + throw new WalletSignMessageError(error, new Error(error)); + } + } + } catch (error: any) { + this.emit('error', error); + throw error; + } + } + + private async checkAndGetWallet() { + this.checkIfOpenOkxWallet(); + await this._checkWallet(); + if (this.state !== AdapterState.Connected) throw new WalletDisconnectedError(); + const wallet = this._wallet; + if (!wallet || !wallet.tronWeb) throw new WalletDisconnectedError(); + return wallet as TronLinkWallet; + } + + private _listenEvent() { + this._stopListenEvent(); + window.addEventListener('message', this.messageHandler); + } + + private _stopListenEvent() { + window.removeEventListener('message', this.messageHandler); + } + + private messageHandler = (e: TronLinkMessageEvent) => { + const message = e.data?.message; + if (!message) { + return; + } + if (message.action === 'accountsChanged') { + setTimeout(() => { + const preAddr = this.address || ''; + if ((this._wallet as TronLinkWallet)?.ready) { + const address = (message.data as AccountsChangedEventData).address; + this.setAddress(address); + this.setState(AdapterState.Connected); + } else { + this.setAddress(null); + this.setState(AdapterState.Disconnect); + } + const address = this.address || ''; + if (address !== preAddr) { + this.emit('accountsChanged', this.address || '', preAddr); + } + if (!preAddr && this.address) { + this.emit('connect', this.address); + } else if (preAddr && !this.address) { + this.emit('disconnect'); + } + }, 200); + } else if (message.action === 'connect') { + const isCurConnected = this.connected; + const preAddress = this.address || ''; + const address = (this._wallet as TronLinkWallet).tronWeb?.defaultAddress?.base58 || ''; + this.setAddress(address); + this.setState(AdapterState.Connected); + if (!isCurConnected) { + this.emit('connect', address); + } else if (address !== preAddress) { + this.emit('accountsChanged', this.address || '', preAddress); + } + } else if (message.action === 'disconnect') { + this.setAddress(null); + this.setState(AdapterState.Disconnect); + this.emit('disconnect'); + } + }; + + private checkIfOpenOkxWallet() { + if (this.config.openAppWithDeeplink === false) { + return; + } + if (openOkxWallet()) { + throw new WalletNotFoundError(); + } + } + + private _checkPromise: Promise | null = null; + /** + * check if wallet exists by interval, the promise only resolve when wallet detected or timeout + * @returns if OkxWallet exists + */ + private _checkWallet(): Promise { + if (this.readyState === WalletReadyState.Found) { + return Promise.resolve(true); + } + if (this._checkPromise) { + return this._checkPromise; + } + const interval = 100; + const maxTimes = Math.floor(this.config.checkTimeout / interval); + let times = 0, + timer: ReturnType; + this._checkPromise = new Promise((resolve) => { + const check = () => { + times++; + const isSupport = supportOkxWallet(); + if (isSupport || times > maxTimes) { + timer && clearInterval(timer); + this._readyState = isSupport ? WalletReadyState.Found : WalletReadyState.NotFound; + this._updateWallet(); + this.emit('readyStateChanged', this.readyState); + resolve(isSupport); + } + }; + timer = setInterval(check, interval); + check(); + }); + return this._checkPromise; + } + + private _updateWallet = () => { + let state = this.state; + let address = this.address; + if (supportOkxWallet()) { + this._wallet = window.okxwallet!.tronLink; + this._listenEvent(); + address = this._wallet.tronWeb?.defaultAddress?.base58 || null; + state = this._wallet.ready ? AdapterState.Connected : AdapterState.Disconnect; + } else { + this._wallet = null; + address = null; + state = AdapterState.NotFound; + } + this.setAddress(address); + this.setState(state); + }; + + private setAddress(address: string | null) { + this._address = address; + } + + private setState(state: AdapterState) { + const preState = this.state; + if (state !== preState) { + this._state = state; + this.emit('stateChanged', state); + } + } +} diff --git a/lib/wallets/tron/connectors/tokenPocket.ts b/lib/wallets/tron/connectors/tokenPocket.ts new file mode 100644 index 000000000..5cfa811c0 --- /dev/null +++ b/lib/wallets/tron/connectors/tokenPocket.ts @@ -0,0 +1,364 @@ +import { + Adapter, + AdapterState, + isInBrowser, + WalletReadyState, + WalletSignMessageError, + WalletNotFoundError, + WalletDisconnectedError, + WalletSignTransactionError, + WalletGetNetworkError, + isInMobileBrowser, +} from '@tronweb3/tronwallet-abstract-adapter'; +import type { + Transaction, + SignedTransaction, + AdapterName, + BaseAdapterConfig, + Network, + TronWeb, +} from '@tronweb3/tronwallet-abstract-adapter'; +import { getNetworkInfoByTronWeb } from '@tronweb3/tronwallet-adapter-tronlink'; +import type { Tron } from '@tronweb3/tronwallet-adapter-tronlink'; + +export function supportTokenPocket() { + return !!window.tronWeb && typeof (window as any).tokenpocket !== 'undefined'; +} + +/** + * Detect if in TokenPocketApp + * There will be a `tokenpocket` object on window + */ +export function isInTokenPocket() { + return isInBrowser() && typeof (window as any).tokenpocket !== 'undefined'; +} + +export function openTokenPocket() { + if (!supportTokenPocket() && isInMobileBrowser() && !isInTokenPocket()) { + const { origin, pathname, search, hash } = window.location; + const url = origin + pathname + search + hash; + const params = { + action: 'open', + actionId: Date.now() + '', + callbackUrl: 'http://someurl.com', // no need callback + blockchain: 'Tron', + chain: 'Tron', + url, + protocol: 'TokenPocket', + version: '1.0', + }; + window.location.href = `tpdapp://open?params=${encodeURIComponent(JSON.stringify(params))}`; + return true; + } + return false; +} + +export interface TokenPocketAdapterConfig extends BaseAdapterConfig { + /** + * Timeout in millisecond for checking if is in TokenPocket App. + * Default is 2 * 1000ms + */ + checkTimeout?: number; + /** + * Set if open TokenPocket app using DeepLink. + * Default is true. + */ + openAppWithDeeplink?: boolean; +} + +export const TokenPocketAdapterName = 'TokenPocket' as AdapterName<'TokenPocket'>; + +export interface TokenPocketWallet { + ready: boolean; + tronWeb: TronWeb; + tron: Tron; +} + +declare global { + interface Window { + tokenpocket?: TokenPocketWallet; + } +} + +export class TokenPocketAdapter extends Adapter { + name = TokenPocketAdapterName; + url = 'https://tokenpocket.pro/'; + icon = + 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIwIiBoZWlnaHQ9IjEyMCIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGc+CjxwYXRoIGQ9Ik0xMDQxLjUyIDBILTI3VjEwMjRIMTA0MS41MlYwWiIgZmlsbD0iIzI5ODBGRSIvPgo8ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfNDA4XzIyNSkiPgo8cGF0aCBkPSJNNDA2Ljc5NiA0MzguNjQzSDQwNi45MjdDNDA2Ljc5NiA0MzcuODU3IDQwNi43OTYgNDM2Ljk0IDQwNi43OTYgNDM2LjE1NFY0MzguNjQzWiIgZmlsbD0iIzI5QUVGRiIvPgo8cGF0aCBkPSJNNjY3LjYwMiA0NjMuNTMzSDUyMy4yNDlWNzI0LjA3NkM1MjMuMjQ5IDczNi4zODkgNTMzLjIwNCA3NDYuMzQ1IDU0NS41MTcgNzQ2LjM0NUg2NDUuMzMzQzY1Ny42NDcgNzQ2LjM0NSA2NjcuNjAyIDczNi4zODkgNjY3LjYwMiA3MjQuMDc2VjQ2My41MzNaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNNDUzLjU2MyAyNzdINDQ4LjcxNkgxOTAuMjY5QzE3Ny45NTUgMjc3IDE2OCAyODYuOTU1IDE2OCAyOTkuMjY5VjM4OS42NTNDMTY4IDQwMS45NjcgMTc3Ljk1NSA0MTEuOTIyIDE5MC4yNjkgNDExLjkyMkgyNTAuOTE4SDI3NS4wMjFWNDM4LjY0NFY3MjQuNzMxQzI3NS4wMjEgNzM3LjA0NSAyODQuOTc2IDc0NyAyOTcuMjg5IDc0N0gz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WalletReadyState = isInBrowser() ? WalletReadyState.Loading : WalletReadyState.NotFound; + private _state: AdapterState = AdapterState.Loading; + private _connecting: boolean; + private _wallet: TokenPocketWallet | null; + private _address: string | null; + + constructor(config: TokenPocketAdapterConfig = {}) { + super(); + const { checkTimeout = 2 * 1000, openUrlWhenWalletNotFound = true, openAppWithDeeplink = true } = config; + if (typeof checkTimeout !== 'number') { + throw new Error('[TokenPocketAdapter] config.checkTimeout should be a number'); + } + this.config = { + checkTimeout, + openAppWithDeeplink, + openUrlWhenWalletNotFound, + }; + this._connecting = false; + this._wallet = null; + this._address = null; + + if (supportTokenPocket()) { + this._readyState = WalletReadyState.Found; + this._updateWallet(); + } else { + this._checkWallet().then(() => { + if (this.connected) { + this.emit('connect', this.address || ''); + } + }); + } + } + + get address() { + return this._address; + } + + get state() { + return this._state; + } + get readyState() { + return this._readyState; + } + + get connecting() { + return this._connecting; + } + + /** + * Get network information. + * @returns {Network} Current network information. + */ + async network(): Promise { + try { + await this._checkWallet(); + if (this.state !== AdapterState.Connected) throw new WalletDisconnectedError(); + const wallet = this._wallet; + if (!wallet || !wallet.tronWeb) throw new WalletDisconnectedError(); + try { + return await getNetworkInfoByTronWeb(wallet.tronWeb); + } catch (e: any) { + throw new WalletGetNetworkError(e?.message, e); + } + } catch (e: any) { + this.emit('error', e); + throw e; + } + } + + async connect(): Promise { + try { + this.checkIfOpenApp(); + if (this.connected || this.connecting) return; + await this._checkWallet(); + if (this.readyState === WalletReadyState.NotFound) { + if (this.config.openUrlWhenWalletNotFound !== false && isInBrowser()) { + window.open(this.url, '_blank'); + } + throw new WalletNotFoundError(); + } + if (!this._wallet) return; + this._connecting = true; + const wallet = this._wallet as TokenPocketWallet; + + const res = await wallet.tron.request({ method: 'eth_requestAccounts' }); + const address = res[0]; + + this.setAddress(address); + this.setState(AdapterState.Connected); + this.emit('connect', this.address || ''); + } catch (error: any) { + this.emit('error', error); + throw error; + } finally { + this._connecting = false; + } + } + + async disconnect(): Promise { + if (this.state !== AdapterState.Connected) { + return; + } + this.setAddress(null); + this.setState(AdapterState.Disconnect); + this.emit('disconnect'); + } + + async signTransaction(transaction: Transaction, privateKey?: string): Promise { + try { + const wallet = await this.checkAndGetWallet(); + try { + return await wallet.tronWeb.trx.sign(transaction, privateKey); + } catch (error: any) { + if (error instanceof Error) { + throw new WalletSignTransactionError(error.message, error); + } else { + throw new WalletSignTransactionError(error, new Error(error)); + } + } + } catch (error: any) { + this.emit('error', error); + throw error; + } + } + + async multiSign( + transaction: Transaction, + privateKey?: string | false, + permissionId?: number + ): Promise { + try { + const wallet = await this.checkAndGetWallet(); + try { + return await wallet.tronWeb.trx.multiSign(transaction, privateKey, permissionId); + } catch (error: any) { + if (error instanceof Error) { + throw new WalletSignTransactionError(error.message, error); + } else { + throw new WalletSignTransactionError(error, new Error(error)); + } + } + } catch (error: any) { + this.emit('error', error); + throw error; + } + } + + async signMessage(message: string, privateKey?: string): Promise { + try { + const wallet = await this.checkAndGetWallet(); + try { + return await wallet.tronWeb.trx.signMessageV2(message, privateKey); + } catch (error: any) { + if (error instanceof Error) { + throw new WalletSignMessageError(error.message, error); + } else { + throw new WalletSignMessageError(error, new Error(error)); + } + } + } catch (error: any) { + this.emit('error', error); + throw error; + } + } + + private async checkAndGetWallet() { + this.checkIfOpenApp(); + await this._checkWallet(); + if (!this.connected) throw new WalletDisconnectedError(); + const wallet = this._wallet; + if (!wallet || !wallet.tronWeb) throw new WalletDisconnectedError(); + return wallet as TokenPocketWallet; + } + + private checkIfOpenApp() { + if (this.config.openAppWithDeeplink === false) { + return; + } + if (openTokenPocket()) { + throw new WalletNotFoundError(); + } + } + + private checkReadyInterval: ReturnType | null = null; + private checkForWalletReady() { + if (this.checkReadyInterval) { + return; + } + let times = 0; + const maxTimes = Math.floor(this.config.checkTimeout / 200); + const check = () => { + if (window?.tronWeb?.ready) { + this.checkReadyInterval && clearInterval(this.checkReadyInterval); + this.checkReadyInterval = null; + this._updateWallet(); + this.emit('connect', this.address || ''); + } else if (times > maxTimes) { + this.checkReadyInterval && clearInterval(this.checkReadyInterval); + this.checkReadyInterval = null; + } else { + times++; + } + }; + this.checkReadyInterval = setInterval(check, 200); + } + + private _checkPromise: Promise | null = null; + /** + * check if wallet exists by interval, the promise only resolve when wallet detected or timeout + * @returns if wallet exists + */ + private _checkWallet(): Promise { + if (this.readyState === WalletReadyState.Found) { + return Promise.resolve(true); + } + if (this._checkPromise) { + return this._checkPromise; + } + const interval = 100; + const maxTimes = Math.floor(this.config.checkTimeout / interval); + let times = 0, + timer: ReturnType; + this._checkPromise = new Promise((resolve) => { + const check = () => { + times++; + const isSupport = supportTokenPocket(); + if (isSupport || times > maxTimes) { + timer && clearInterval(timer); + this._readyState = isSupport ? WalletReadyState.Found : WalletReadyState.NotFound; + this._updateWallet(); + this.emit('readyStateChanged', this.readyState); + resolve(isSupport); + } + }; + timer = setInterval(check, interval); + check(); + }); + return this._checkPromise; + } + + private _updateWallet = () => { + let state = this.state; + let address = this.address; + if (supportTokenPocket()) { + this._wallet = { + tron: window.tokenpocket?.tron, + ready: window.tronWeb?.ready, + tronWeb: window.tokenpocket?.tronWeb, + } as TokenPocketWallet; + address = this._wallet.tronWeb.defaultAddress?.base58 || null; + state = window.tronWeb?.ready ? AdapterState.Connected : AdapterState.Disconnect; + if (!window.tronWeb?.ready) { + this.checkForWalletReady(); + } + } else { + this._wallet = null; + address = null; + state = AdapterState.NotFound; + } + this.setAddress(address); + this.setState(state); + }; + + private setAddress(address: string | null) { + this._address = address; + } + + private setState(state: AdapterState) { + const preState = this.state; + if (state !== preState) { + this._state = state; + this.emit('stateChanged', state); + } + } +} diff --git a/lib/wallets/tron/useTron.ts b/lib/wallets/tron/useTron.ts index 25fa0fdc3..f6eae412c 100644 --- a/lib/wallets/tron/useTron.ts +++ b/lib/wallets/tron/useTron.ts @@ -3,6 +3,7 @@ import { useWallet } from '@tronweb3/tronwallet-adapter-react-hooks'; import { InternalConnector, Wallet, WalletProvider } from "../../../Models/WalletProvider"; import { resolveWalletConnectorIcon } from "../utils/resolveWalletIcon"; import { useConnectModal } from "../../../components/WalletModal"; +import { useSettingsState } from "../../../context/settings"; export default function useTron(): WalletProvider { const commonSupportedNetworks = [ @@ -10,6 +11,8 @@ export default function useTron(): WalletProvider { KnownInternalNames.Networks.TronTestnet ] + const { networks } = useSettingsState() + const network = networks.find(n => n.name === KnownInternalNames.Networks.TronMainnet || n.name === KnownInternalNames.Networks.TronTestnet) const name = 'Tron' const id = 'tron' const { wallets, wallet: tronWallet, disconnect, select } = useWallet(); @@ -18,10 +21,12 @@ export default function useTron(): WalletProvider { const address = tronWallet?.adapter.address - const wallet = address ? { + const wallet: Wallet | undefined = address ? { + id: tronWallet.adapter.name, addresses: [address], address, - connector: name, + displayName: `${tronWallet.adapter.name} - Tron`, + networkIcon: network?.logo, providerName: id, isActive: true, icon: resolveWalletConnectorIcon({ connector: name, address, iconUrl: tronWallet.adapter.icon }), @@ -61,8 +66,10 @@ export default function useTron(): WalletProvider { const connectedAddress = connectedWallet?.adapter.address const wallet: Wallet | undefined = connectedAddress ? { address: connectedAddress, - connector: connectedWallet?.adapter.name, providerName: name, + id: connectedWallet?.adapter.name, + displayName: `${connectedWallet.adapter.name} - Tron`, + networkIcon: network?.logo, icon: resolveWalletConnectorIcon({ connector: String(connectedWallet?.adapter.name), address: connectedAddress }), disconnect, connect: () => connectWallet(), diff --git a/package.json b/package.json index e3c52d6f3..4c99ecb62 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ }, "dependencies": { "@badrap/bar-of-progress": "^0.2.2", + "@bitget-wallet/web3-sdk": "^0.0.8", "@datadog/browser-rum": "^5.9.0", "@eth-optimism/contracts-ts": "^0.15.0", "@ethereumjs/util": "^9.1.0", @@ -60,7 +61,6 @@ "@ton/ton": "^13.11.1", "@tonconnect/ui-react": "^2.0.0-beta.4", "@tronweb3/tronwallet-adapter-react-hooks": "^1.1.9", - "@tronweb3/tronwallet-adapters": "^1.2.6", "@uidotdev/usehooks": "^2.4.1", "@walletconnect/universal-provider": "^2.17.0", "axios": "^0.21.4", diff --git a/yarn.lock b/yarn.lock index 8549b8d4f..f967cfc6e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -24,11 +24,6 @@ resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== -"@adraffy/ens-normalize@1.9.0": - version "1.9.0" - resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.9.0.tgz#223572538f6bea336750039bb43a4016dcc8182d" - integrity sha512-iowxq3U30sghZotgl4s/oJRci6WPBfNO5YYgk2cIOMCHr3LeGPcsZjCEr+33Q4N+oV3OABDAtA+pyvWjbvBifQ== - "@adraffy/ens-normalize@^1.10.1": version "1.11.0" resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.11.0.tgz#42cc67c5baa407ac25059fcd7d405cc5ecdb0c33" @@ -1787,7 +1782,7 @@ react-keyed-flatten-children "^3.0.0" ts-deepmerge "^6.2.0" -"@bitget-wallet/web3-sdk@0.0.8": +"@bitget-wallet/web3-sdk@^0.0.8": version "0.0.8" resolved "https://registry.yarnpkg.com/@bitget-wallet/web3-sdk/-/web3-sdk-0.0.8.tgz#1510b0b379654ff0de5e10ae19bef93fa86e46c3" integrity sha512-WFk6URUxTCukKrU3YpTdWTCScrj6/wwd/0O7eSANeQl1KDbDs+yj/fAkN1Wy6ebI3NMcW6sqN9mrmfwz53dPMQ== @@ -1806,21 +1801,6 @@ eventemitter3 "^5.0.1" preact "^10.24.2" -"@coinbase/wallet-sdk@^3.6.6": - version "3.9.3" - resolved "https://registry.yarnpkg.com/@coinbase/wallet-sdk/-/wallet-sdk-3.9.3.tgz#daf10cb0c85d0363315b7270cb3f02bedc408aab" - integrity sha512-N/A2DRIf0Y3PHc1XAMvbBUu4zisna6qAdqABMZwBMNEfWrXpAwx16pZGkYCLGE+Rvv1edbcB2LYDRnACNcmCiw== - dependencies: - bn.js "^5.2.1" - buffer "^6.0.3" - clsx "^1.2.1" - eth-block-tracker "^7.1.0" - eth-json-rpc-filters "^6.0.0" - eventemitter3 "^5.0.1" - keccak "^3.0.3" - preact "^10.16.0" - sha.js "^2.4.11" - "@colors/colors@1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" @@ -3458,13 +3438,6 @@ resolved "https://registry.yarnpkg.com/@ledgerhq/errors/-/errors-6.19.1.tgz#d9ac45ad4ff839e468b8f63766e665537aaede58" integrity sha512-75yK7Nnit/Gp7gdrJAz0ipp31CCgncRp+evWt6QawQEtQKYEDfGo10QywgrrBBixeRxwnMy1DP6g2oCWRf1bjw== -"@ledgerhq/hw-app-trx@^6.27.8": - version "6.29.4" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-trx/-/hw-app-trx-6.29.4.tgz#2daf9763281a53422ed591de99dbf3b8be9abe2a" - integrity sha512-CKxkNkmFW/JhOVaRubHNRibIKyyX6GSaaEm58ST2AHV98CRFzn0SgI/vqIzQTnLwuFuI823lCKI6urSmje6cnw== - dependencies: - "@ledgerhq/hw-transport" "^6.31.4" - "@ledgerhq/hw-transport-webhid@6.27.1": version "6.27.1" resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport-webhid/-/hw-transport-webhid-6.27.1.tgz#8fd1710d23b6bd7cbe2382dd02054dfabe788447" @@ -3484,7 +3457,7 @@ "@ledgerhq/errors" "^6.10.0" events "^3.3.0" -"@ledgerhq/hw-transport@^6.27.1", "@ledgerhq/hw-transport@^6.31.4": +"@ledgerhq/hw-transport@^6.27.1": version "6.31.4" resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport/-/hw-transport-6.31.4.tgz#9b23a6de4a4caaa5c24b149c2dea8adde46f0eb1" integrity sha512-6c1ir/cXWJm5dCWdq55NPgCJ3UuKuuxRvf//Xs36Bq9BwkV2YaRQhZITAkads83l07NAdR16hkTWqqpwFMaI6A== @@ -3956,13 +3929,6 @@ resolved "https://registry.yarnpkg.com/@noble/ciphers/-/ciphers-1.1.3.tgz#eb27085aa7ce94d8c6eaeb64299bab0589920ec1" integrity sha512-Ygv6WnWJHLLiW4fnNDC1z+i13bud+enXOFRBlpxI+NJliPWx5wdR+oWlTjLuBPTqjUjtHXtjkU6w3kuuH6upZA== -"@noble/curves@1.0.0", "@noble/curves@~1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.0.0.tgz#e40be8c7daf088aaf291887cbc73f43464a92932" - integrity sha512-2upgEu0iLiDVDZkNLeFV2+ht0BAVgQnEmCk6JsOch9Rp8xfkMCbvbAZlA2pBHQc73dbl+vFOXfqkf4uemdn0bw== - dependencies: - "@noble/hashes" "1.3.0" - "@noble/curves@1.2.0", "@noble/curves@~1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" @@ -3996,11 +3962,6 @@ resolved "https://registry.yarnpkg.com/@noble/ed25519/-/ed25519-1.7.3.tgz#57e1677bf6885354b466c38e2b620c62f45a7123" integrity sha512-iR8GBkDt0Q3GyaVcIu7mSsVIqnFbkbRzGLWlvhwunacoLwt4J3swfKhfaM6rN6WY+TBGoYT1GtT1mIh2/jGbRQ== -"@noble/hashes@1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.0.tgz#085fd70f6d7d9d109671090ccae1d3bec62554a1" - integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg== - "@noble/hashes@1.3.2": version "1.3.2" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" @@ -5482,7 +5443,7 @@ resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.10.4.tgz#427d5549943a9c6fce808e39ea64dbe60d4047f1" integrity sha512-WJgX9nzTqknM393q1QJDJmoW28kUfEnybeTfVNcNAPnIx210RXm2DiXiHzfNPJNIUUb1tJnz/l4QGtJ30PgWmA== -"@safe-global/safe-apps-provider@0.18.4", "@safe-global/safe-apps-provider@^0.18.1": +"@safe-global/safe-apps-provider@0.18.4": version "0.18.4" resolved "https://registry.yarnpkg.com/@safe-global/safe-apps-provider/-/safe-apps-provider-0.18.4.tgz#53df912aa20d933f6b14c5bcb0737a8cd47def57" integrity sha512-SWYeG3gyTO6wGHMSokfHakZ9isByn2mHsM0VohIorYFFEyGGmJ89btnTm+DqDUSoQtvWAatZB7XNy6CaYMvqtg== @@ -5498,14 +5459,6 @@ "@safe-global/safe-gateway-typescript-sdk" "^3.5.3" viem "^2.1.1" -"@safe-global/safe-apps-sdk@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@safe-global/safe-apps-sdk/-/safe-apps-sdk-8.1.0.tgz#d1d0c69cd2bf4eef8a79c5d677d16971926aa64a" - integrity sha512-XJbEPuaVc7b9n23MqlF6c+ToYIS3f7P2Sel8f3cSBQ9WORE4xrSuvhMpK9fDSFqJ7by/brc+rmJR/5HViRr0/w== - dependencies: - "@safe-global/safe-gateway-typescript-sdk" "^3.5.3" - viem "^1.0.0" - "@safe-global/safe-gateway-typescript-sdk@^3.5.3": version "3.22.4" resolved "https://registry.yarnpkg.com/@safe-global/safe-gateway-typescript-sdk/-/safe-gateway-typescript-sdk-3.22.4.tgz#9109a538df40f778666a3e6776e7a08c757e893d" @@ -5521,15 +5474,6 @@ resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.9.tgz#e5e142fbbfe251091f9c5f1dd4c834ac04c3dbd1" integrity sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg== -"@scure/bip32@1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.0.tgz#6c8d980ef3f290987736acd0ee2e0f0d50068d87" - integrity sha512-bcKpo1oj54hGholplGLpqPHRbIsnbixFtc06nwuNM5/dwSXOq/AAYoIBRsBmnZJSdfeNW5rnff7NTAz3ZCqR9Q== - dependencies: - "@noble/curves" "~1.0.0" - "@noble/hashes" "~1.3.0" - "@scure/base" "~1.1.0" - "@scure/bip32@1.3.2": version "1.3.2" resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.2.tgz#90e78c027d5e30f0b22c1f8d50ff12f3fb7559f8" @@ -5557,14 +5501,6 @@ "@noble/hashes" "~1.6.0" "@scure/base" "~1.2.1" -"@scure/bip39@1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.0.tgz#a207e2ef96de354de7d0002292ba1503538fc77b" - integrity sha512-SX/uKq52cuxm4YFXWFaVByaSHJh2w3BnokVSeUJVCv6K7WulT9u2BuNRBhuFl8vAuYnzx9bEu9WgpcNYTrYieg== - dependencies: - "@noble/hashes" "~1.3.0" - "@scure/base" "~1.1.0" - "@scure/bip39@1.2.1": version "1.2.1" resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.1.tgz#5cee8978656b272a917b7871c981e0541ad6ac2a" @@ -6902,7 +6838,7 @@ resolved "https://registry.yarnpkg.com/@stablelib/wipe/-/wipe-1.0.1.tgz#d21401f1d59ade56a62e139462a97f104ed19a36" integrity sha512-WfqfX/eXGiAd3RJe4VU2snh/ZPwtSjLG4ynQ/vYzvghTh7dHFcI1wl+nrkWG6lGhukOxOsUHfv8dUXr58D0ayg== -"@stablelib/x25519@1.0.3", "@stablelib/x25519@^1.0.3": +"@stablelib/x25519@1.0.3": version "1.0.3" resolved "https://registry.yarnpkg.com/@stablelib/x25519/-/x25519-1.0.3.tgz#13c8174f774ea9f3e5e42213cbf9fc68a3c7b7fd" integrity sha512-KnTbKmUhPhHavzobclVJQG5kuivH+qDLpe84iRqX3CLrKp881cF160JvXJ+hjn1aMyCwYOKeIZefIH/P5cJoRw== @@ -9227,68 +9163,6 @@ dependencies: eventemitter3 "^4.0.0" -"@tronweb3/tronwallet-adapter-bitkeep@^1.1.3": - version "1.1.3" - resolved "https://registry.yarnpkg.com/@tronweb3/tronwallet-adapter-bitkeep/-/tronwallet-adapter-bitkeep-1.1.3.tgz#128cae695ab193961e41ca005dc515368cfb0a3c" - integrity sha512-1Nvxt8P8HbXgC4ccIxyv41Wda9+w2ublfhKtQiOO7nkrdTsr2wYaJ8qenB53r1qm7VWeUTZ+6c0zq5NK6Y+WUA== - dependencies: - "@bitget-wallet/web3-sdk" "0.0.8" - "@tronweb3/tronwallet-abstract-adapter" "^1.1.8" - "@tronweb3/tronwallet-adapter-tronlink" "^1.1.11" - -"@tronweb3/tronwallet-adapter-bybit@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@tronweb3/tronwallet-adapter-bybit/-/tronwallet-adapter-bybit-1.0.0.tgz#726854dd9fa063c16b138201751cbfe92806e3a4" - integrity sha512-ksmdazU9eWaHr/zG1oMnCcXRi5ezR6OZmU3N7NV2ofyk8MoiyyD8fL/ezQ3D+1YRwfh+tpJa3o5ym6thEa/vsQ== - dependencies: - "@tronweb3/tronwallet-abstract-adapter" "^1.1.8" - "@tronweb3/tronwallet-adapter-tronlink" "^1.1.11" - -"@tronweb3/tronwallet-adapter-foxwallet@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@tronweb3/tronwallet-adapter-foxwallet/-/tronwallet-adapter-foxwallet-1.0.0.tgz#9bb933b9eae8168881fef3cbf64dd2e426b3ca65" - integrity sha512-IBKVcxipR/p5rrl5k89Es+aIY6I7xhtxLyachebEJMeSjJ7/09zRHLQ47kXOTM9cIk/izKMm+klzhdFxXadpjA== - dependencies: - "@tronweb3/tronwallet-abstract-adapter" "^1.1.8" - "@tronweb3/tronwallet-adapter-tronlink" "^1.1.11" - -"@tronweb3/tronwallet-adapter-gatewallet@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@tronweb3/tronwallet-adapter-gatewallet/-/tronwallet-adapter-gatewallet-1.0.1.tgz#9e3ebb1ffb934e02417c4e6b30b0c08236a9f9f6" - integrity sha512-tCCA42KisAl1zIs6PfPS33msoXUJ25z9B5shVHoIQvZ13QdHgzzshOIz6ocr2fdRvT04A+Phl/UH2Oq4pZtG5A== - dependencies: - "@tronweb3/tronwallet-abstract-adapter" "^1.1.8" - "@tronweb3/tronwallet-adapter-tronlink" "^1.1.11" - -"@tronweb3/tronwallet-adapter-imtoken@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@tronweb3/tronwallet-adapter-imtoken/-/tronwallet-adapter-imtoken-1.0.1.tgz#1822b43c0f9549bca0bc661a7869bc50ded8452e" - integrity sha512-LsZ+qQsf2iwawEh99PMBzYBK09luopeBX98XWGSnQJaqfJJzqcwATeKubEh5VTgZDvCs1MbwEuFULx503/8DLw== - dependencies: - "@tronweb3/tronwallet-abstract-adapter" "^1.1.8" - "@tronweb3/tronwallet-adapter-tronlink" "^1.1.11" - -"@tronweb3/tronwallet-adapter-ledger@^1.1.10": - version "1.1.10" - resolved "https://registry.yarnpkg.com/@tronweb3/tronwallet-adapter-ledger/-/tronwallet-adapter-ledger-1.1.10.tgz#340205b805f18fd353d40c150b1322b17107129b" - integrity sha512-DGMTMIpvnuDnX0FRCsAt1p4S1CQWgDF4taSenEhLVrI46v+yq39NxfarZo7k6UWhlZsH4AVELEhNzFnmZLEx9A== - dependencies: - "@ledgerhq/hw-app-trx" "^6.27.8" - "@ledgerhq/hw-transport" "6.27.1" - "@ledgerhq/hw-transport-webhid" "6.27.1" - "@tronweb3/tronwallet-abstract-adapter" "^1.1.8" - buffer "^6.0.3" - eventemitter3 "^4.0.0" - preact "^10.11.3" - -"@tronweb3/tronwallet-adapter-okxwallet@^1.0.5": - version "1.0.5" - resolved "https://registry.yarnpkg.com/@tronweb3/tronwallet-adapter-okxwallet/-/tronwallet-adapter-okxwallet-1.0.5.tgz#4a92fd9be8dcd1a45520d3b19cdf72661f8a242a" - integrity sha512-SW+Y801ntTtmyOxcuoMgEO8Ob9T5AEvrmXZX6z3ma6+LScNXQxLiDcbg6A/0OslrPKlO7fWyJI3nkasR3+KO3Q== - dependencies: - "@tronweb3/tronwallet-abstract-adapter" "^1.1.8" - "@tronweb3/tronwallet-adapter-tronlink" "^1.1.11" - "@tronweb3/tronwallet-adapter-react-hooks@^1.1.9": version "1.1.9" resolved "https://registry.yarnpkg.com/@tronweb3/tronwallet-adapter-react-hooks/-/tronwallet-adapter-react-hooks-1.1.9.tgz#a8b9a517456a05971d28c813eb92de636f1cd38f" @@ -9297,14 +9171,6 @@ "@tronweb3/tronwallet-abstract-adapter" "^1.1.8" "@tronweb3/tronwallet-adapter-tronlink" "^1.1.11" -"@tronweb3/tronwallet-adapter-tokenpocket@^1.0.5": - version "1.0.5" - resolved "https://registry.yarnpkg.com/@tronweb3/tronwallet-adapter-tokenpocket/-/tronwallet-adapter-tokenpocket-1.0.5.tgz#82fa1bcf1b8a564081658d814363c3a9bb6c3f20" - integrity sha512-6Rrb8p+Cy4E57mbd25QjGPbLfnGilsBCcJdWx2+0eZzKsYZGcTwRBybepDbIcZHETe8ijqL+A6KPl1QWaTQ1og== - dependencies: - "@tronweb3/tronwallet-abstract-adapter" "^1.1.8" - "@tronweb3/tronwallet-adapter-tronlink" "^1.1.11" - "@tronweb3/tronwallet-adapter-tronlink@^1.1.11": version "1.1.11" resolved "https://registry.yarnpkg.com/@tronweb3/tronwallet-adapter-tronlink/-/tronwallet-adapter-tronlink-1.1.11.tgz#facda2d9b3aeaa5d508c7f8520b1e8970264c4bf" @@ -9312,43 +9178,6 @@ dependencies: "@tronweb3/tronwallet-abstract-adapter" "^1.1.8" -"@tronweb3/tronwallet-adapter-walletconnect@^2.0.2": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@tronweb3/tronwallet-adapter-walletconnect/-/tronwallet-adapter-walletconnect-2.0.2.tgz#17f095976485fba61c5f2cf9b5bd6d43bcfe8ebf" - integrity sha512-uHA/HzM0pCR/G8BiwP92Xiy4e6/AtF59lcHezVW5h/1mHJZjzYuzq+jE73fEAXDYuvApIWpZTZ8bi02BwW5/FA== - dependencies: - "@tronweb3/tronwallet-abstract-adapter" "^1.1.8" - "@tronweb3/walletconnect-tron" "^3.0.0" - "@wagmi/core" "^1.1.0" - "@walletconnect/sign-client" "^2.1.4" - "@walletconnect/types" "^2.1.4" - viem "^0.3.50" - -"@tronweb3/tronwallet-adapters@^1.2.6": - version "1.2.6" - resolved "https://registry.yarnpkg.com/@tronweb3/tronwallet-adapters/-/tronwallet-adapters-1.2.6.tgz#ceb780a503fc75f6a2fc8966fe6888c0d4ffa8bf" - integrity sha512-X1MjaZsInvpYCTlhzJ+c+mF7qN5GWoI02JVmNXmqFt0GjUgAD/i1YX2dw6UVkBfzf4yghh34Geayh9nrgRi6Kg== - dependencies: - "@tronweb3/tronwallet-adapter-bitkeep" "^1.1.3" - "@tronweb3/tronwallet-adapter-bybit" "^1.0.0" - "@tronweb3/tronwallet-adapter-foxwallet" "^1.0.0" - "@tronweb3/tronwallet-adapter-gatewallet" "^1.0.1" - "@tronweb3/tronwallet-adapter-imtoken" "^1.0.1" - "@tronweb3/tronwallet-adapter-ledger" "^1.1.10" - "@tronweb3/tronwallet-adapter-okxwallet" "^1.0.5" - "@tronweb3/tronwallet-adapter-tokenpocket" "^1.0.5" - "@tronweb3/tronwallet-adapter-tronlink" "^1.1.11" - "@tronweb3/tronwallet-adapter-walletconnect" "^2.0.2" - -"@tronweb3/walletconnect-tron@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@tronweb3/walletconnect-tron/-/walletconnect-tron-3.0.0.tgz#4081b6462072c6b3871e74510f329b486db084a4" - integrity sha512-aYFbUsZHYumdGXt+1VN4mN9Cjr1+GWYr7cXOLawoQ1WqiHOlAiovSnsTpGhUFLn2FZV8m6rdnXTZ59S/0Mv9mw== - dependencies: - "@walletconnect/modal" "^2.6.2" - "@walletconnect/sign-client" "^2.1.3" - "@walletconnect/utils" "^2.1.3" - "@trpc/client@^10.38.1": version "10.45.2" resolved "https://registry.yarnpkg.com/@trpc/client/-/client-10.45.2.tgz#15f9ba81303bf3417083fc6bb742e4e86b49da90" @@ -10143,26 +9972,6 @@ tiny-invariant "^1.1.0" tiny-warning "^1.0.3" -"@wagmi/chains@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@wagmi/chains/-/chains-1.0.0.tgz#41710941f2c2a699a246c4e3a6112b4efd996171" - integrity sha512-eNbqRWyHbivcMNq5tbXJks4NaOzVLHnNQauHPeE/EDT9AlpqzcrMc+v2T1/2Iw8zN4zgqB86NCsxeJHJs7+xng== - -"@wagmi/connectors@3.1.11": - version "3.1.11" - resolved "https://registry.yarnpkg.com/@wagmi/connectors/-/connectors-3.1.11.tgz#98c3a73555bd4c96e562b0258bb2c770fa37b621" - integrity sha512-wzxp9f9PtSUFjDUP/QDjc1t7HON4D8wrVKsw35ejdO8hToDpx1gU9lwH/47Zo/1zExGezQc392sjoHSszYd7OA== - dependencies: - "@coinbase/wallet-sdk" "^3.6.6" - "@safe-global/safe-apps-provider" "^0.18.1" - "@safe-global/safe-apps-sdk" "^8.1.0" - "@walletconnect/ethereum-provider" "2.11.0" - "@walletconnect/legacy-provider" "^2.0.0" - "@walletconnect/modal" "2.6.2" - "@walletconnect/utils" "2.11.0" - abitype "0.8.7" - eventemitter3 "^4.0.7" - "@wagmi/connectors@5.6.1": version "5.6.1" resolved "https://registry.yarnpkg.com/@wagmi/connectors/-/connectors-5.6.1.tgz#948ca387916136501da80989f3eba351b0c6a595" @@ -10184,16 +9993,6 @@ mipd "0.0.7" zustand "5.0.0" -"@wagmi/core@^1.1.0": - version "1.4.13" - resolved "https://registry.yarnpkg.com/@wagmi/core/-/core-1.4.13.tgz#8a29bb0370141d48232e3d0b60011dbd8f91a37d" - integrity sha512-ytMCvXbBOgfDu9Qw67279wq/jNEe7EZLjLyekX7ROnvHRADqFr3lwZI6ih41UmtRZAmXAx8Ghyuqy154EjB5mQ== - dependencies: - "@wagmi/connectors" "3.1.11" - abitype "0.8.7" - eventemitter3 "^4.0.7" - zustand "^4.3.1" - "@wallet-standard/app@^1.0.1", "@wallet-standard/app@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@wallet-standard/app/-/app-1.1.0.tgz#2ca32e4675536224ebe55a00ad533b7923d7380a" @@ -10250,29 +10049,6 @@ "@walletconnect/window-metadata" "1.0.0" detect-browser "5.2.0" -"@walletconnect/core@2.11.0": - version "2.11.0" - resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-2.11.0.tgz#3a4e301077b2f858fd916b7a20b5b984d1afce63" - integrity sha512-2Tjp5BCevI7dbmqo/OrCjX4tqgMqwJNQLlQAlphqPfvwlF9+tIu6pGcVbSN3U9zyXzWIZCeleqEaWUeSeET4Ew== - dependencies: - "@walletconnect/heartbeat" "1.2.1" - "@walletconnect/jsonrpc-provider" "1.0.13" - "@walletconnect/jsonrpc-types" "1.0.3" - "@walletconnect/jsonrpc-utils" "1.0.8" - "@walletconnect/jsonrpc-ws-connection" "1.0.14" - "@walletconnect/keyvaluestorage" "^1.1.1" - "@walletconnect/logger" "^2.0.1" - "@walletconnect/relay-api" "^1.0.9" - "@walletconnect/relay-auth" "^1.0.4" - "@walletconnect/safe-json" "^1.0.2" - "@walletconnect/time" "^1.0.2" - "@walletconnect/types" "2.11.0" - "@walletconnect/utils" "2.11.0" - events "^3.3.0" - isomorphic-unfetch "3.1.0" - lodash.isequal "4.5.0" - uint8arrays "^3.1.0" - "@walletconnect/core@2.17.0": version "2.17.0" resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-2.17.0.tgz#bf490e85a4702eff0f7cf81ba0d3c1016dffff33" @@ -10318,27 +10094,6 @@ lodash.isequal "4.5.0" uint8arrays "3.1.0" -"@walletconnect/crypto@^1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@walletconnect/crypto/-/crypto-1.0.3.tgz#7b8dd4d7e2884fe3543c7c07aea425eef5ef9dd4" - integrity sha512-+2jdORD7XQs76I2Odgr3wwrtyuLUXD/kprNVsjWRhhhdO9Mt6WqVzOPu0/t7OHSmgal8k7SoBQzUc5hu/8zL/g== - dependencies: - "@walletconnect/encoding" "^1.0.2" - "@walletconnect/environment" "^1.0.1" - "@walletconnect/randombytes" "^1.0.3" - aes-js "^3.1.2" - hash.js "^1.1.7" - tslib "1.14.1" - -"@walletconnect/encoding@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@walletconnect/encoding/-/encoding-1.0.2.tgz#cb3942ad038d6a6bf01158f66773062dd25724da" - integrity sha512-CrwSBrjqJ7rpGQcTL3kU+Ief+Bcuu9PH6JLOb+wM6NITX1GTxR/MfNwnQfhLKK6xpRAyj2/nM04OOH6wS8Imag== - dependencies: - is-typedarray "1.0.0" - tslib "1.14.1" - typedarray-to-buffer "3.1.5" - "@walletconnect/environment@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@walletconnect/environment/-/environment-1.0.1.tgz#1d7f82f0009ab821a2ba5ad5e5a7b8ae3b214cd7" @@ -10346,22 +10101,6 @@ dependencies: tslib "1.14.1" -"@walletconnect/ethereum-provider@2.11.0": - version "2.11.0" - resolved "https://registry.yarnpkg.com/@walletconnect/ethereum-provider/-/ethereum-provider-2.11.0.tgz#feb90368d8b2608d7d120ac8feeb3e26eac8c709" - integrity sha512-YrTeHVjuSuhlUw7SQ6xBJXDuJ6iAC+RwINm9nVhoKYJSHAy3EVSJZOofMKrnecL0iRMtD29nj57mxAInIBRuZA== - dependencies: - "@walletconnect/jsonrpc-http-connection" "^1.0.7" - "@walletconnect/jsonrpc-provider" "^1.0.13" - "@walletconnect/jsonrpc-types" "^1.0.3" - "@walletconnect/jsonrpc-utils" "^1.0.8" - "@walletconnect/modal" "^2.6.2" - "@walletconnect/sign-client" "2.11.0" - "@walletconnect/types" "2.11.0" - "@walletconnect/universal-provider" "2.11.0" - "@walletconnect/utils" "2.11.0" - events "^3.3.0" - "@walletconnect/ethereum-provider@2.17.0": version "2.17.0" resolved "https://registry.yarnpkg.com/@walletconnect/ethereum-provider/-/ethereum-provider-2.17.0.tgz#d74feaaed6180a6799e96760d7ee867ff3a083d2" @@ -10403,15 +10142,6 @@ keyvaluestorage-interface "^1.0.0" tslib "1.14.1" -"@walletconnect/heartbeat@1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@walletconnect/heartbeat/-/heartbeat-1.2.1.tgz#afaa3a53232ae182d7c9cff41c1084472d8f32e9" - integrity sha512-yVzws616xsDLJxuG/28FqtZ5rzrTA4gUjdEMTbWB5Y8V1XHRmqq4efAxCw5ie7WjbXFSUyBHaWlMR+2/CpQC5Q== - dependencies: - "@walletconnect/events" "^1.0.1" - "@walletconnect/time" "^1.0.2" - tslib "1.14.1" - "@walletconnect/heartbeat@1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@walletconnect/heartbeat/-/heartbeat-1.2.2.tgz#e8dc5179db7769950c6f9cf59b23516d9b95227d" @@ -10421,7 +10151,7 @@ "@walletconnect/time" "^1.0.2" events "^3.3.0" -"@walletconnect/jsonrpc-http-connection@1.0.8", "@walletconnect/jsonrpc-http-connection@^1.0.4", "@walletconnect/jsonrpc-http-connection@^1.0.7": +"@walletconnect/jsonrpc-http-connection@1.0.8": version "1.0.8" resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-http-connection/-/jsonrpc-http-connection-1.0.8.tgz#2f4c3948f074960a3edd07909560f3be13e2c7ae" integrity sha512-+B7cRuaxijLeFDJUq5hAzNyef3e3tBDIxyaCNmFtjwnod5AGis3RToNqzFU33vpVcxFhofkpE7Cx+5MYejbMGw== @@ -10431,16 +10161,7 @@ cross-fetch "^3.1.4" events "^3.3.0" -"@walletconnect/jsonrpc-provider@1.0.13": - version "1.0.13" - resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.13.tgz#9a74da648d015e1fffc745f0c7d629457f53648b" - integrity sha512-K73EpThqHnSR26gOyNEL+acEex3P7VWZe6KE12ZwKzAt2H4e5gldZHbjsu2QR9cLeJ8AXuO7kEMOIcRv1QEc7g== - dependencies: - "@walletconnect/jsonrpc-utils" "^1.0.8" - "@walletconnect/safe-json" "^1.0.2" - tslib "1.14.1" - -"@walletconnect/jsonrpc-provider@1.0.14", "@walletconnect/jsonrpc-provider@^1.0.13", "@walletconnect/jsonrpc-provider@^1.0.6": +"@walletconnect/jsonrpc-provider@1.0.14": version "1.0.14" resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.14.tgz#696f3e3b6d728b361f2e8b853cfc6afbdf2e4e3e" integrity sha512-rtsNY1XqHvWj0EtITNeuf8PHMvlCLiS3EjQL+WOkxEOA4KPxsohFnBDeyPYiNm4ZvkQdLnece36opYidmtbmow== @@ -10449,14 +10170,6 @@ "@walletconnect/safe-json" "^1.0.2" events "^3.3.0" -"@walletconnect/jsonrpc-types@1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.3.tgz#65e3b77046f1a7fa8347ae02bc1b841abe6f290c" - integrity sha512-iIQ8hboBl3o5ufmJ8cuduGad0CQm3ZlsHtujv9Eu16xq89q+BG7Nh5VLxxUgmtpnrePgFkTwXirCTkwJH1v+Yw== - dependencies: - keyvaluestorage-interface "^1.0.0" - tslib "1.14.1" - "@walletconnect/jsonrpc-types@1.0.4", "@walletconnect/jsonrpc-types@^1.0.2", "@walletconnect/jsonrpc-types@^1.0.3": version "1.0.4" resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.4.tgz#ce1a667d79eadf2a2d9d002c152ceb68739c230c" @@ -10465,7 +10178,7 @@ events "^3.3.0" keyvaluestorage-interface "^1.0.0" -"@walletconnect/jsonrpc-utils@1.0.8", "@walletconnect/jsonrpc-utils@^1.0.4", "@walletconnect/jsonrpc-utils@^1.0.6", "@walletconnect/jsonrpc-utils@^1.0.7", "@walletconnect/jsonrpc-utils@^1.0.8": +"@walletconnect/jsonrpc-utils@1.0.8", "@walletconnect/jsonrpc-utils@^1.0.6", "@walletconnect/jsonrpc-utils@^1.0.8": version "1.0.8" resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-utils/-/jsonrpc-utils-1.0.8.tgz#82d0cc6a5d6ff0ecc277cb35f71402c91ad48d72" integrity sha512-vdeb03bD8VzJUL6ZtzRYsFMq1eZQcM3EAzT0a3st59dyLfJ0wq+tKMpmGH7HlB7waD858UWgfIcudbPFsbzVdw== @@ -10484,7 +10197,7 @@ events "^3.3.0" ws "^7.5.1" -"@walletconnect/keyvaluestorage@1.1.1", "@walletconnect/keyvaluestorage@^1.1.1": +"@walletconnect/keyvaluestorage@1.1.1": version "1.1.1" resolved "https://registry.yarnpkg.com/@walletconnect/keyvaluestorage/-/keyvaluestorage-1.1.1.tgz#dd2caddabfbaf80f6b8993a0704d8b83115a1842" integrity sha512-V7ZQq2+mSxAq7MrRqDxanTzu2RcElfK1PfNYiaVnJgJ7Q7G7hTVwF8voIBx92qsRyGHZihrwNPHuZd1aKkd0rA== @@ -10493,67 +10206,7 @@ idb-keyval "^6.2.1" unstorage "^1.9.0" -"@walletconnect/legacy-client@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@walletconnect/legacy-client/-/legacy-client-2.0.0.tgz#9f2c09694789fd4b6c5d68d6423b44bac55aed30" - integrity sha512-v5L7rYk9loVnfvUf0mF+76bUPFaU5/Vh7mzL6/950CD/yoGdzYZ3Kj+L7mkC6HPMEGeQsBP1+sqBuiVGZ/aODA== - dependencies: - "@walletconnect/crypto" "^1.0.3" - "@walletconnect/encoding" "^1.0.2" - "@walletconnect/jsonrpc-utils" "^1.0.4" - "@walletconnect/legacy-types" "^2.0.0" - "@walletconnect/legacy-utils" "^2.0.0" - "@walletconnect/safe-json" "^1.0.1" - "@walletconnect/window-getters" "^1.0.1" - "@walletconnect/window-metadata" "^1.0.1" - detect-browser "^5.3.0" - query-string "^6.13.5" - -"@walletconnect/legacy-modal@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@walletconnect/legacy-modal/-/legacy-modal-2.0.0.tgz#d0fab01a1337a8f5d88cdb1430cbef2d46072bbf" - integrity sha512-jckNd8lMhm4X7dX9TDdxM3bXKJnaqkRs6K2Mo5j6GmbIF9Eyx40jZ5+q457RVxvM6ciZEDT5s1wBHWdWoOo+9Q== - dependencies: - "@walletconnect/legacy-types" "^2.0.0" - "@walletconnect/legacy-utils" "^2.0.0" - copy-to-clipboard "^3.3.3" - preact "^10.12.0" - qrcode "^1.5.1" - -"@walletconnect/legacy-provider@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@walletconnect/legacy-provider/-/legacy-provider-2.0.0.tgz#08e2db1e4c234743b2f30422bc8100bc42e8fc44" - integrity sha512-A8xPebMI1A+50HbWwTpFCbwP7G+1NGKdTKyg8BUUg3h3Y9JucpC1W6w/x0v1Xw7qFEqQnz74LoIN/A3ytH9xrQ== - dependencies: - "@walletconnect/jsonrpc-http-connection" "^1.0.4" - "@walletconnect/jsonrpc-provider" "^1.0.6" - "@walletconnect/legacy-client" "^2.0.0" - "@walletconnect/legacy-modal" "^2.0.0" - "@walletconnect/legacy-types" "^2.0.0" - "@walletconnect/legacy-utils" "^2.0.0" - -"@walletconnect/legacy-types@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@walletconnect/legacy-types/-/legacy-types-2.0.0.tgz#224278ae2874c6a2ca805c2d1d062a511dcf7227" - integrity sha512-sOVrA7HUdbI1OwKyPOQU0/DdvTSVFlsXWpAk2K2WvP2erTkBWPMTJq6cv2BmKdoJ3p6gLApT7sd+jHi3OF71uw== - dependencies: - "@walletconnect/jsonrpc-types" "^1.0.2" - -"@walletconnect/legacy-utils@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@walletconnect/legacy-utils/-/legacy-utils-2.0.0.tgz#e3a637c00783f9cd2ae139b640f82223ab78ed9d" - integrity sha512-CPWxSVVXw0kgNCxvU126g4GiV3mzXmC8IPJ15twE46aJ1FX+RHEIfAzFMFz2F2+fEhBxL63A7dwNQKDXorRPcQ== - dependencies: - "@walletconnect/encoding" "^1.0.2" - "@walletconnect/jsonrpc-utils" "^1.0.4" - "@walletconnect/legacy-types" "^2.0.0" - "@walletconnect/safe-json" "^1.0.1" - "@walletconnect/window-getters" "^1.0.1" - "@walletconnect/window-metadata" "^1.0.1" - detect-browser "^5.3.0" - query-string "^6.13.5" - -"@walletconnect/logger@2.1.2", "@walletconnect/logger@^2.0.1": +"@walletconnect/logger@2.1.2": version "2.1.2" resolved "https://registry.yarnpkg.com/@walletconnect/logger/-/logger-2.1.2.tgz#813c9af61b96323a99f16c10089bfeb525e2a272" integrity sha512-aAb28I3S6pYXZHQm5ESB+V6rDqIYfsnHaQyzFbwUUBFY4H0OXx/YtTl8lvhUNhMMfb9UxbwEBS253TlXUYJWSw== @@ -10566,13 +10219,6 @@ resolved "https://registry.yarnpkg.com/@walletconnect/mobile-registry/-/mobile-registry-1.4.0.tgz#502cf8ab87330841d794819081e748ebdef7aee5" integrity sha512-ZtKRio4uCZ1JUF7LIdecmZt7FOLnX72RPSY7aUVu7mj7CSfxDwUn6gBuK6WGtH+NZCldBqDl5DenI5fFSvkKYw== -"@walletconnect/modal-core@2.6.2": - version "2.6.2" - resolved "https://registry.yarnpkg.com/@walletconnect/modal-core/-/modal-core-2.6.2.tgz#d73e45d96668764e0c8668ea07a45bb8b81119e9" - integrity sha512-cv8ibvdOJQv2B+nyxP9IIFdxvQznMz8OOr/oR/AaUZym4hjXNL/l1a2UlSQBXrVjo3xxbouMxLb3kBsHoYP2CA== - dependencies: - valtio "1.11.2" - "@walletconnect/modal-core@2.7.0": version "2.7.0" resolved "https://registry.yarnpkg.com/@walletconnect/modal-core/-/modal-core-2.7.0.tgz#73c13c3b7b0abf9ccdbac9b242254a86327ce0a4" @@ -10580,16 +10226,6 @@ dependencies: valtio "1.11.2" -"@walletconnect/modal-ui@2.6.2": - version "2.6.2" - resolved "https://registry.yarnpkg.com/@walletconnect/modal-ui/-/modal-ui-2.6.2.tgz#fa57c087c57b7f76aaae93deab0f84bb68b59cf9" - integrity sha512-rbdstM1HPGvr7jprQkyPggX7rP4XiCG85ZA+zWBEX0dVQg8PpAgRUqpeub4xQKDgY7pY/xLRXSiCVdWGqvG2HA== - dependencies: - "@walletconnect/modal-core" "2.6.2" - lit "2.8.0" - motion "10.16.2" - qrcode "1.5.3" - "@walletconnect/modal-ui@2.7.0": version "2.7.0" resolved "https://registry.yarnpkg.com/@walletconnect/modal-ui/-/modal-ui-2.7.0.tgz#dbbb7ee46a5a25f7d39db622706f2d197b268cbb" @@ -10600,14 +10236,6 @@ motion "10.16.2" qrcode "1.5.3" -"@walletconnect/modal@2.6.2": - version "2.6.2" - resolved "https://registry.yarnpkg.com/@walletconnect/modal/-/modal-2.6.2.tgz#4b534a836f5039eeb3268b80be7217a94dd12651" - integrity sha512-eFopgKi8AjKf/0U4SemvcYw9zlLpx9njVN8sf6DAkowC2Md0gPU/UNEbH1Wwj407pEKnEds98pKWib1NN1ACoA== - dependencies: - "@walletconnect/modal-core" "2.6.2" - "@walletconnect/modal-ui" "2.6.2" - "@walletconnect/modal@2.7.0", "@walletconnect/modal@^2.6.2": version "2.7.0" resolved "https://registry.yarnpkg.com/@walletconnect/modal/-/modal-2.7.0.tgz#55f969796d104cce1205f5f844d8f8438b79723a" @@ -10628,24 +10256,14 @@ preact "10.4.1" qrcode "1.4.4" -"@walletconnect/randombytes@^1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@walletconnect/randombytes/-/randombytes-1.0.3.tgz#e795e4918367fd1e6a2215e075e64ab93e23985b" - integrity sha512-35lpzxcHFbTN3ABefC9W+uBpNZl1GC4Wpx0ed30gibfO/y9oLdy1NznbV96HARQKSBV9J9M/rrtIvf6a23jfYw== - dependencies: - "@walletconnect/encoding" "^1.0.2" - "@walletconnect/environment" "^1.0.1" - randombytes "^2.1.0" - tslib "1.14.1" - -"@walletconnect/relay-api@1.0.11", "@walletconnect/relay-api@^1.0.9": +"@walletconnect/relay-api@1.0.11": version "1.0.11" resolved "https://registry.yarnpkg.com/@walletconnect/relay-api/-/relay-api-1.0.11.tgz#80ab7ef2e83c6c173be1a59756f95e515fb63224" integrity sha512-tLPErkze/HmC9aCmdZOhtVmYZq1wKfWTJtygQHoWtgg722Jd4homo54Cs4ak2RUFUZIGO2RsOpIcWipaua5D5Q== dependencies: "@walletconnect/jsonrpc-types" "^1.0.2" -"@walletconnect/relay-auth@1.0.4", "@walletconnect/relay-auth@^1.0.4": +"@walletconnect/relay-auth@1.0.4": version "1.0.4" resolved "https://registry.yarnpkg.com/@walletconnect/relay-auth/-/relay-auth-1.0.4.tgz#0b5c55c9aa3b0ef61f526ce679f3ff8a5c4c2c7c" integrity sha512-kKJcS6+WxYq5kshpPaxGHdwf5y98ZwbfuS4EE/NkQzqrDFm5Cj+dP8LofzWvjrrLkZq7Afy7WrQMXdLy8Sx7HQ== @@ -10669,21 +10287,6 @@ dependencies: tslib "1.14.1" -"@walletconnect/sign-client@2.11.0": - version "2.11.0" - resolved "https://registry.yarnpkg.com/@walletconnect/sign-client/-/sign-client-2.11.0.tgz#de10f976cc1b8ab04b7f7c27f6a298e4e083ab25" - integrity sha512-H2ukscibBS+6WrzQWh+WyVBqO5z4F5et12JcwobdwgHnJSlqIoZxqnUYYWNCI5rUR5UKsKWaUyto4AE9N5dw4Q== - dependencies: - "@walletconnect/core" "2.11.0" - "@walletconnect/events" "^1.0.1" - "@walletconnect/heartbeat" "1.2.1" - "@walletconnect/jsonrpc-utils" "1.0.8" - "@walletconnect/logger" "^2.0.1" - "@walletconnect/time" "^1.0.2" - "@walletconnect/types" "2.11.0" - "@walletconnect/utils" "2.11.0" - events "^3.3.0" - "@walletconnect/sign-client@2.17.0": version "2.17.0" resolved "https://registry.yarnpkg.com/@walletconnect/sign-client/-/sign-client-2.17.0.tgz#efe811b1bb10082d964e2f0378aaa1b40f424503" @@ -10699,7 +10302,7 @@ "@walletconnect/utils" "2.17.0" events "3.3.0" -"@walletconnect/sign-client@2.17.2", "@walletconnect/sign-client@^2.1.3", "@walletconnect/sign-client@^2.1.4", "@walletconnect/sign-client@^2.11.0", "@walletconnect/sign-client@^2.7.2": +"@walletconnect/sign-client@2.17.2", "@walletconnect/sign-client@^2.11.0", "@walletconnect/sign-client@^2.7.2": version "2.17.2" resolved "https://registry.yarnpkg.com/@walletconnect/sign-client/-/sign-client-2.17.2.tgz#b8bd125d7c34a67916745ebbdbbc834db5518c8b" integrity sha512-/wigdCIQjlBXSWY43Id0IPvZ5biq4HiiQZti8Ljvx408UYjmqcxcBitbj2UJXMYkid7704JWAB2mw32I1HgshQ== @@ -10721,18 +10324,6 @@ dependencies: tslib "1.14.1" -"@walletconnect/types@2.11.0": - version "2.11.0" - resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-2.11.0.tgz#474a009c56faa9ef4063b76ed84415c801dc9f1e" - integrity sha512-AB5b1lrEbCGHxqS2vqfCkIoODieH+ZAUp9rA1O2ftrhnqDJiJK983Df87JhYhECsQUBHHfALphA8ydER0q+9sw== - dependencies: - "@walletconnect/events" "^1.0.1" - "@walletconnect/heartbeat" "1.2.1" - "@walletconnect/jsonrpc-types" "1.0.3" - "@walletconnect/keyvaluestorage" "^1.1.1" - "@walletconnect/logger" "^2.0.1" - events "^3.3.0" - "@walletconnect/types@2.17.0": version "2.17.0" resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-2.17.0.tgz#20eda5791e3172f8ab9146caa3f317701d4b3232" @@ -10745,7 +10336,7 @@ "@walletconnect/logger" "2.1.2" events "3.3.0" -"@walletconnect/types@2.17.2", "@walletconnect/types@^2.1.4": +"@walletconnect/types@2.17.2": version "2.17.2" resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-2.17.2.tgz#f9afff242563be33f377de689b03b482f5b20aee" integrity sha512-j/+0WuO00lR8ntu7b1+MKe/r59hNwYLFzW0tTmozzhfAlDL+dYwWasDBNq4AH8NbVd7vlPCQWmncH7/6FVtOfQ== @@ -10762,21 +10353,6 @@ resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-1.8.0.tgz#3f5e85b2d6b149337f727ab8a71b8471d8d9a195" integrity sha512-Cn+3I0V0vT9ghMuzh1KzZvCkiAxTq+1TR2eSqw5E5AVWfmCtECFkVZBP6uUJZ8YjwLqXheI+rnjqPy7sVM4Fyg== -"@walletconnect/universal-provider@2.11.0": - version "2.11.0" - resolved "https://registry.yarnpkg.com/@walletconnect/universal-provider/-/universal-provider-2.11.0.tgz#89053c2360b5ce766c213ca4e33bb4ce4976b0be" - integrity sha512-zgJv8jDvIMP4Qse/D9oIRXGdfoNqonsrjPZanQ/CHNe7oXGOBiQND2IIeX+tS0H7uNA0TPvctljCLiIN9nw4eA== - dependencies: - "@walletconnect/jsonrpc-http-connection" "^1.0.7" - "@walletconnect/jsonrpc-provider" "1.0.13" - "@walletconnect/jsonrpc-types" "^1.0.2" - "@walletconnect/jsonrpc-utils" "^1.0.7" - "@walletconnect/logger" "^2.0.1" - "@walletconnect/sign-client" "2.11.0" - "@walletconnect/types" "2.11.0" - "@walletconnect/utils" "2.11.0" - events "^3.3.0" - "@walletconnect/universal-provider@2.17.0": version "2.17.0" resolved "https://registry.yarnpkg.com/@walletconnect/universal-provider/-/universal-provider-2.17.0.tgz#c9d4bbd9b8f0e41b500b2488ccbc207dc5f7a170" @@ -10810,26 +10386,6 @@ events "3.3.0" lodash "4.17.21" -"@walletconnect/utils@2.11.0": - version "2.11.0" - resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-2.11.0.tgz#31c95151c823022077883dda61800cdea71879b7" - integrity sha512-hxkHPlTlDQILHfIKXlmzgNJau/YcSBC3XHUSuZuKZbNEw3duFT6h6pm3HT/1+j1a22IG05WDsNBuTCRkwss+BQ== - dependencies: - "@stablelib/chacha20poly1305" "1.0.1" - "@stablelib/hkdf" "1.0.1" - "@stablelib/random" "^1.0.2" - "@stablelib/sha256" "1.0.1" - "@stablelib/x25519" "^1.0.3" - "@walletconnect/relay-api" "^1.0.9" - "@walletconnect/safe-json" "^1.0.2" - "@walletconnect/time" "^1.0.2" - "@walletconnect/types" "2.11.0" - "@walletconnect/window-getters" "^1.0.1" - "@walletconnect/window-metadata" "^1.0.1" - detect-browser "5.3.0" - query-string "7.1.3" - uint8arrays "^3.1.0" - "@walletconnect/utils@2.17.0": version "2.17.0" resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-2.17.0.tgz#02b3af0b80d0c1a994d692d829d066271b04d071" @@ -10852,7 +10408,7 @@ query-string "7.1.3" uint8arrays "3.1.0" -"@walletconnect/utils@2.17.2", "@walletconnect/utils@^2.1.3", "@walletconnect/utils@^2.4.5": +"@walletconnect/utils@2.17.2", "@walletconnect/utils@^2.4.5": version "2.17.2" resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-2.17.2.tgz#b4b12e3f5ebbfd883b2a5c87fb818e53501dc7ea" integrity sha512-T7eLRiuw96fgwUy2A5NZB5Eu87ukX8RCVoO9lji34RFV4o2IGU9FhTEWyd4QQKI8OuQRjSknhbJs0tU0r0faPw== @@ -10897,7 +10453,7 @@ dependencies: "@walletconnect/window-getters" "^1.0.0" -"@walletconnect/window-metadata@1.0.1", "@walletconnect/window-metadata@^1.0.1": +"@walletconnect/window-metadata@1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@walletconnect/window-metadata/-/window-metadata-1.0.1.tgz#2124f75447b7e989e4e4e1581d55d25bc75f7be5" integrity sha512-9koTqyGrM2cqFRW517BPY/iEtUDx2r1+Pwwu5m7sJ7ka79wi3EyqhqcICk/yDmv6jAS1rjKgTKXlEhanYjijcA== @@ -11129,11 +10685,6 @@ abi-wan-kanabi@^2.2.4: fs-extra "^10.0.0" yargs "^17.7.2" -abitype@0.8.7: - version "0.8.7" - resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.8.7.tgz#e4b3f051febd08111f486c0cc6a98fa72d033622" - integrity sha512-wQ7hV8Yg/yKmGyFpqrNZufCxbszDe5es4AZGYPBitocfSqXtjrTG9JMWFcc4N30ukl2ve48aBTwt7NJxVQdU3w== - abitype@0.9.8: version "0.9.8" resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.9.8.tgz#1f120b6b717459deafd213dfbf3a3dd1bf10ae8c" @@ -12929,7 +12480,7 @@ cookiejar@^2.1.1: resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.4.tgz#ee669c1fea2cf42dc31585469d193fef0d65771b" integrity sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw== -copy-to-clipboard@^3.3.1, copy-to-clipboard@^3.3.3: +copy-to-clipboard@^3.3.1: version "3.3.3" resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz#55ac43a1db8ae639a4bd99511c148cdd1b83a1b0" integrity sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA== @@ -16743,19 +16294,6 @@ isomorphic-fetch@^3.0.0: node-fetch "^2.6.1" whatwg-fetch "^3.4.1" -isomorphic-unfetch@3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz#87341d5f4f7b63843d468438128cb087b7c3e98f" - integrity sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q== - dependencies: - node-fetch "^2.6.1" - unfetch "^4.2.0" - -isomorphic-ws@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz#e5529148912ecb9b451b46ed44d53dae1ce04bbf" - integrity sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw== - isomorphic-ws@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc" @@ -19725,7 +19263,7 @@ preact@10.4.1: resolved "https://registry.yarnpkg.com/preact/-/preact-10.4.1.tgz#9b3ba020547673a231c6cf16f0fbaef0e8863431" integrity sha512-WKrRpCSwL2t3tpOOGhf2WfTpcmbpxaWtDbdJdKdjd0aEiTkvOmS4NBkG6kzlaAHI9AkQ3iVqbFWM3Ei7mZ4o1Q== -preact@^10.11.3, preact@^10.12.0, preact@^10.16.0, preact@^10.24.2: +preact@^10.16.0, preact@^10.24.2: version "10.24.3" resolved "https://registry.yarnpkg.com/preact/-/preact-10.24.3.tgz#086386bd47071e3b45410ef20844c21e23828f64" integrity sha512-Z2dPnBnMUfyQfSQ+GBdsGa16hz35YmLmtTLhM169uW944hYL6xzTYkJjC07j+Wosz733pMWx0fgON3JNw1jJQA== @@ -20046,7 +19584,7 @@ qrcode@1.5.3: pngjs "^5.0.0" yargs "^15.3.1" -qrcode@^1.5.1, qrcode@^1.5.4: +qrcode@^1.5.4: version "1.5.4" resolved "https://registry.yarnpkg.com/qrcode/-/qrcode-1.5.4.tgz#5cb81d86eb57c675febb08cf007fff963405da88" integrity sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg== @@ -20093,16 +19631,6 @@ query-string@^5.0.1: object-assign "^4.1.0" strict-uri-encode "^1.0.0" -query-string@^6.13.5: - version "6.14.1" - resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.14.1.tgz#7ac2dca46da7f309449ba0f86b1fd28255b0c86a" - integrity sha512-XDxAeVmpfu1/6IjyT/gXHOl+S0vQ9owggJ30hhWKdHAsNPOcasn5o9BW0eejZqL2e4vMjhAxoW3jVHcD6mbcYw== - dependencies: - decode-uri-component "^0.2.0" - filter-obj "^1.1.0" - split-on-first "^1.0.0" - strict-uri-encode "^2.0.0" - querystring-es3@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" @@ -22749,7 +22277,7 @@ uint8arrays@3.1.0: dependencies: multiformats "^9.4.2" -uint8arrays@^3.0.0, uint8arrays@^3.1.0: +uint8arrays@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-3.1.1.tgz#2d8762acce159ccd9936057572dade9459f65ae0" integrity sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg== @@ -22807,7 +22335,7 @@ unfetch@^3.1.1: resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-3.1.2.tgz#dc271ef77a2800768f7b459673c5604b5101ef77" integrity sha512-L0qrK7ZeAudGiKYw6nzFjnJ2D5WHblUBwmHIqtPS6oKUd+Hcpk7/hKsSmcHsTlpd1TbTNsiRBUKRq3bHLNIqIw== -unfetch@^4.1.0, unfetch@^4.2.0: +unfetch@^4.1.0: version "4.2.0" resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-4.2.0.tgz#7e21b0ef7d363d8d9af0fb929a5555f6ef97a3be" integrity sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA== @@ -23238,22 +22766,7 @@ viem@2.x, viem@^2.1.1, viem@^2.21.1, viem@^2.21.16: webauthn-p256 "0.0.10" ws "8.18.0" -viem@^0.3.50: - version "0.3.50" - resolved "https://registry.yarnpkg.com/viem/-/viem-0.3.50.tgz#999a7682eda7eabc48c923f4b9923c3f098fc1ab" - integrity sha512-s+LxCYZTR9F/qPk1/n1YDVAX9vSeVz7GraqBZWGrDuenCJxo9ArCoIceJ6ksI0WwSeNzcZ0VVbD/kWRzTxkipw== - dependencies: - "@adraffy/ens-normalize" "1.9.0" - "@noble/curves" "1.0.0" - "@noble/hashes" "1.3.0" - "@scure/bip32" "1.3.0" - "@scure/bip39" "1.2.0" - "@wagmi/chains" "1.0.0" - abitype "0.8.7" - isomorphic-ws "5.0.0" - ws "8.12.0" - -viem@^1.0.0, viem@^1.3.0: +viem@^1.3.0: version "1.21.4" resolved "https://registry.yarnpkg.com/viem/-/viem-1.21.4.tgz#883760e9222540a5a7e0339809202b45fe6a842d" integrity sha512-BNVYdSaUjeS2zKQgPs+49e5JKocfo60Ib2yiXOWBT6LuVxY1I/6fFX3waEtpXvL1Xn4qu+BVitVtMh9lyThyhQ== @@ -23995,11 +23508,6 @@ ws@7.4.6: resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== -ws@8.12.0: - version "8.12.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.12.0.tgz#485074cc392689da78e1828a9ff23585e06cddd8" - integrity sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig== - ws@8.13.0: version "8.13.0" resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" @@ -24298,7 +23806,7 @@ zustand@5.0.0: resolved "https://registry.yarnpkg.com/zustand/-/zustand-5.0.0.tgz#71f8aaecf185592a3ba2743d7516607361899da9" integrity sha512-LE+VcmbartOPM+auOjCCLQOsQ05zUTp8RkgwRzefUk+2jISdMMFnxvyTjA4YNWr5ZGXYbVsEMZosttuxUBkojQ== -zustand@^4.3.1, zustand@^4.4.1: +zustand@^4.4.1: version "4.5.5" resolved "https://registry.yarnpkg.com/zustand/-/zustand-4.5.5.tgz#f8c713041543715ec81a2adda0610e1dc82d4ad1" integrity sha512-+0PALYNJNgK6hldkgDq2vLrw5f6g/jCInz52n9RTpropGgeAf/ioFUCdtsjCqu4gNhW9D01rUQBROoRjdzyn2Q==