From 994f033170169f60fa5d250870977de2c290038d Mon Sep 17 00:00:00 2001 From: Manan Tank Date: Sat, 17 Feb 2024 05:15:16 +0530 Subject: [PATCH] Add QR connection support in Coinbase wallet --- packages/thirdweb/package.json | 1 + .../react/providers/thirdweb-provider-ctx.tsx | 2 +- .../src/react/providers/thirdweb-provider.tsx | 5 +- packages/thirdweb/src/react/types/wallets.ts | 2 +- .../react/wallets/coinbase/coinbaseConfig.tsx | 148 ++++++- .../src/wallets/coinbase/coinbaseMetadata.ts | 8 + .../src/wallets/coinbase/coinbaseSDKWallet.ts | 386 ++++++++++++++++++ packages/thirdweb/src/wallets/index.ts | 8 +- .../src/wallets/injected/wallets/coinbase.ts | 9 +- packages/thirdweb/tsconfig.base.json | 4 +- pnpm-lock.yaml | 29 +- 11 files changed, 542 insertions(+), 60 deletions(-) create mode 100644 packages/thirdweb/src/wallets/coinbase/coinbaseMetadata.ts create mode 100644 packages/thirdweb/src/wallets/coinbase/coinbaseSDKWallet.ts diff --git a/packages/thirdweb/package.json b/packages/thirdweb/package.json index 5c2e8f34584..d7f5fa98e64 100644 --- a/packages/thirdweb/package.json +++ b/packages/thirdweb/package.json @@ -137,6 +137,7 @@ "!tsconfig.build.json" ], "dependencies": { + "@coinbase/wallet-sdk": "^3.7.1", "@emotion/react": "11.11.3", "@emotion/styled": "11.11.0", "@noble/hashes": "1.3.3", diff --git a/packages/thirdweb/src/react/providers/thirdweb-provider-ctx.tsx b/packages/thirdweb/src/react/providers/thirdweb-provider-ctx.tsx index 21bb3fcc0e7..db440050791 100644 --- a/packages/thirdweb/src/react/providers/thirdweb-provider-ctx.tsx +++ b/packages/thirdweb/src/react/providers/thirdweb-provider-ctx.tsx @@ -6,5 +6,5 @@ import type { DAppMetaData } from "../../wallets/types.js"; export const ThirdwebProviderContext = /* @__PURE__ */ createContext<{ wallets: WalletConfig[]; client: ThirdwebClient; - dappMetadata?: DAppMetaData; + dappMetadata: DAppMetaData; } | null>(null); diff --git a/packages/thirdweb/src/react/providers/thirdweb-provider.tsx b/packages/thirdweb/src/react/providers/thirdweb-provider.tsx index a5f8b11c88f..6fd398e5148 100644 --- a/packages/thirdweb/src/react/providers/thirdweb-provider.tsx +++ b/packages/thirdweb/src/react/providers/thirdweb-provider.tsx @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable better-tree-shaking/no-top-level-side-effects */ import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { AutoConnect, @@ -23,6 +21,7 @@ import { import { getChainIdFromChain } from "../../chain/index.js"; import type { DAppMetaData } from "../../wallets/types.js"; import { isBaseTransactionOptions } from "../../transaction/index.js"; +import { defaultDappMetadata } from "../../wallets/wallet-connect/index.js"; /** * The ThirdwebProvider is component is a provider component that sets up the React Query client and Wallet Connection Manager. @@ -110,7 +109,7 @@ export function ThirdwebProvider(props: ThirdwebProviderProps) { value={{ wallets: props.wallets || defaultWallets, client: props.client, - dappMetadata: props.dappMetadata, + dappMetadata: props.dappMetadata || defaultDappMetadata, }} > {props.autoConnect === false ? : } diff --git a/packages/thirdweb/src/react/types/wallets.ts b/packages/thirdweb/src/react/types/wallets.ts index ff928d7fc59..07bcd06b5fc 100644 --- a/packages/thirdweb/src/react/types/wallets.ts +++ b/packages/thirdweb/src/react/types/wallets.ts @@ -16,7 +16,7 @@ export type WalletConfig = { create: (options: { client: ThirdwebClient; - dappMetadata?: DAppMetaData; + dappMetadata: DAppMetaData; }) => Wallet; /** diff --git a/packages/thirdweb/src/react/wallets/coinbase/coinbaseConfig.tsx b/packages/thirdweb/src/react/wallets/coinbase/coinbaseConfig.tsx index 6b82d380049..fe2e97acdee 100644 --- a/packages/thirdweb/src/react/wallets/coinbase/coinbaseConfig.tsx +++ b/packages/thirdweb/src/react/wallets/coinbase/coinbaseConfig.tsx @@ -2,9 +2,15 @@ import { injectedCoinbaseProvider, coinbaseMetadata, coinbaseWallet, + coinbaseSDKWallet, + CoinbaseSDKWallet, } from "../../../wallets/index.js"; -import type { WalletConfig } from "../../types/wallets.js"; +import { useTWLocale } from "../../providers/locale-provider.js"; +import type { ConnectUIProps, WalletConfig } from "../../types/wallets.js"; +import { GetStartedScreen } from "../shared/GetStartedScreen.js"; import { InjectedConnectUI } from "../shared/InjectedConnectUI.js"; +import { ScanScreen } from "../shared/ScanScreen.js"; +import { useState, useRef, useEffect } from "react"; /** * Integrate Coinbase wallet connection into your app. @@ -19,29 +25,133 @@ import { InjectedConnectUI } from "../shared/InjectedConnectUI.js"; * @returns WalletConfig object to be passed into `ThirdwebProvider` */ export const coinbaseConfig = (): WalletConfig => { + const isInjected = !!injectedCoinbaseProvider(); + return { metadata: coinbaseMetadata, - create() { - return coinbaseWallet(); - }, - connectUI(props) { - return ( - { - // TODO - }} - // links={{ - // extension: - // "https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad", - // android: "https://play.google.com/store/apps/details?id=org.toshi", - // ios: "https://apps.apple.com/us/app/coinbase-wallet-nfts-crypto/id1278383455", - // }} - /> - ); + create(createOptions) { + if (isInjected) { + return coinbaseWallet(); + } else { + return coinbaseSDKWallet({ + appName: createOptions.dappMetadata.name, + }); + } }, + connectUI: CoinbaseConnectUI, isInstalled() { return !!injectedCoinbaseProvider(); }, }; }; + +const links = { + chrome: + "https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad", + android: "https://play.google.com/store/apps/details?id=org.toshi", + ios: "https://apps.apple.com/us/app/coinbase-wallet-nfts-crypto/id1278383455", +}; + +function CoinbaseConnectUI(props: ConnectUIProps) { + const isInjected = !!injectedCoinbaseProvider(); + const [screen, setScreen] = useState<"main" | "get-started">("main"); + const walletConfig = props.walletConfig; + const locale = useTWLocale().wallets.injectedWallet( + walletConfig.metadata.name, + ); + + if (screen === "get-started") { + return ( + { + setScreen("main"); + }} + /> + ); + } + + if (isInjected) { + return ( + { + setScreen("get-started"); + }} + /> + ); + } + + return ( + { + setScreen("get-started"); + }} + /> + ); +} + +function CoinbaseSDKWalletConnectUI(props: { + connectUIProps: ConnectUIProps; + onGetStarted: () => void; +}) { + const { connectUIProps, onGetStarted } = props; + const locale = useTWLocale().wallets.injectedWallet( + connectUIProps.walletConfig.metadata.name, + ); + const { createInstance, done, chainId } = connectUIProps; + const [qrCodeUri, setQrCodeUri] = useState(undefined); + + const scanStarted = useRef(false); + + useEffect(() => { + if (scanStarted.current) { + return; + } + + scanStarted.current = true; + + (async () => { + const wallet = createInstance() as CoinbaseSDKWallet; + + try { + await wallet.connect({ + reloadOnDisconnect: false, + chainId, + onUri(uri) { + if (uri) { + setQrCodeUri(uri); + } else { + // show error + } + }, + headlessMode: true, + }); + + done(wallet); + } catch { + // show error + } + })(); + }, [chainId, createInstance, done]); + + return ( + + ); +} diff --git a/packages/thirdweb/src/wallets/coinbase/coinbaseMetadata.ts b/packages/thirdweb/src/wallets/coinbase/coinbaseMetadata.ts new file mode 100644 index 00000000000..aae858936fa --- /dev/null +++ b/packages/thirdweb/src/wallets/coinbase/coinbaseMetadata.ts @@ -0,0 +1,8 @@ +import type { WalletMetadata } from "../types.js"; + +export const coinbaseMetadata: WalletMetadata = { + id: "com.coinbase.wallet", + name: "Coinbase Wallet", + iconUrl: + "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjQ4IiBoZWlnaHQ9IjQ4IiByeD0iOCIgZmlsbD0iIzA1NTVGRiIvPgo8ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfMzMwM184NjM0KSI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMTIuMzMxMiA0SDM1LjY2NzJDNDAuMjcwNCA0IDQ0IDguMDEyOCA0NCAx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NDAiIGZpbGw9IndoaXRlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg0IDQpIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==", +}; diff --git a/packages/thirdweb/src/wallets/coinbase/coinbaseSDKWallet.ts b/packages/thirdweb/src/wallets/coinbase/coinbaseSDKWallet.ts new file mode 100644 index 00000000000..ee244a1b997 --- /dev/null +++ b/packages/thirdweb/src/wallets/coinbase/coinbaseSDKWallet.ts @@ -0,0 +1,386 @@ +import type { Account, Wallet } from "../interfaces/wallet.js"; +import type { WalletMetadata } from "../types.js"; +import type { CoinbaseWalletProvider } from "@coinbase/wallet-sdk"; +import type { CoinbaseWalletSDK as CoinbaseWalletSDKConstructor } from "@coinbase/wallet-sdk"; +import { getChainDataForChainId } from "../../chain/index.js"; +import { normalizeChainId } from "../utils/normalizeChainId.js"; +import { + getAddress, + toHex, + type Hex, + stringToHex, + type SignTypedDataParameters, + getTypesForEIP712Domain, + validateTypedData, + isHex, +} from "viem"; +import { getValidPublicRPCUrl } from "../utils/chains.js"; +import type { SendTransactionOption } from "../interfaces/wallet.js"; +import type { Address } from "abitype"; +import { stringify } from "../../utils/json.js"; +import type { Ethereum } from "../interfaces/ethereum.js"; +import { coinbaseMetadata } from "./coinbaseMetadata.js"; +import { + getSavedConnectParamsFromStorage, + saveConnectParamsToStorage, +} from "../manager/storage.js"; + +type SavedConnectParams = { + chainId?: number; +}; + +type CoinbaseWalletSDKOptions = Readonly< + ConstructorParameters[0] +>; + +export type CoinbaseSDKWalletConnectionOptions = Omit< + CoinbaseWalletSDKOptions, + "appName" +> & { + chainId?: number; + onUri?: (uri: string | null) => void; +}; + +export type CoinbaseSDKWalletOptions = { + appName: string; +}; + +/** + * Connect to Coinbase wallet using the Coinbase SDK which allows connecting to Coinbase Wallet extension or mobile app. + * @param options - The options for connecting to the Coinbase Wallet SDK. + * @example + * ```ts + * const wallet = coinbaseSDKWallet() + * ``` + * @returns A `CoinbaseSDKWallet` instance. + */ +export function coinbaseSDKWallet(options: CoinbaseWalletSDKOptions) { + return new CoinbaseSDKWallet(options); +} + +/** + * Connect to Coinbase wallet using the Coinbase SDK which allows connecting to Coinbase Wallet extension or mobile app. + */ +export class CoinbaseSDKWallet implements Wallet { + private options: CoinbaseSDKWalletOptions; + private provider: CoinbaseWalletProvider | undefined; + private chainId: number | undefined; + private account?: Account | undefined; + metadata: WalletMetadata; + + /** + * Create a new CoinbaseSDKWallet instance + * @param options - Options for connecting to the Coinbase Wallet SDK. + * @example + * ```ts + * const wallet = new CoinbaseSDKWallet({ + * appName: "My App" + * }) + * ``` + * @returns A `CoinbaseSDKWallet` instance. + */ + constructor(options: CoinbaseSDKWalletOptions) { + this.options = options; + this.metadata = coinbaseMetadata; + } + + /** + * Get the `chainId` that the wallet is connected to. + * @returns The chainId + * @example + * ```ts + * const chainId = wallet.getChainId(); + * ``` + */ + getChainId(): number | undefined { + return this.chainId; + } + + /** + * Get the connected `Account` from the wallet. + * @returns The connected account + * @example + * ```ts + * const account = wallet.getAccount(); + * ``` + */ + getAccount(): Account | undefined { + return this.account; + } + + /** + * Connect to the Coinbase Wallet + * @param options - The options for connecting to the Injected Wallet Provider. + * @example + * ```ts + * const account = await wallet.connect() + * ``` + * @returns A Promise that resolves to connected `Account` object + */ + async connect(options?: CoinbaseSDKWalletConnectionOptions) { + const provider = await this.initProvider({ + ...options, + }); + + provider.on("accountsChanged", this.onAccountsChanged); + provider.on("chainChanged", this.onChainChanged); + provider.on("disconnect", this.onDisconnect); + + const accounts = (await provider.request({ + method: "eth_requestAccounts", + })) as string[]; + + if (!accounts[0]) { + throw new Error("No accounts found"); + } + + const address = getAddress(accounts[0]); + + const connectedChainId = (await provider.request({ + method: "eth_chainId", + })) as string | number; + // TODO check what's type of connectedChainId + + // Switch to chain if provided + if ( + connectedChainId && + options?.chainId && + Number(connectedChainId) !== options?.chainId + ) { + await this.switchChain(options.chainId); + } + + this.chainId = normalizeChainId(connectedChainId); + + if (options?.chainId) { + const saveParams: SavedConnectParams = { + chainId: options?.chainId, + }; + + saveConnectParamsToStorage(this.metadata.id, saveParams); + } + + return this.onConnect(address); + } + + private onConnect(address: string) { + const wallet = this; + + const account: Account = { + address, + async sendTransaction(tx: SendTransactionOption) { + if (!wallet.chainId || !wallet.provider || !account.address) { + throw new Error("Provider not setup"); + } + + if (normalizeChainId(tx.chainId) !== wallet.chainId) { + await wallet.switchChain(tx.chainId); + } + + const transactionHash = (await wallet.provider.request({ + method: "eth_sendTransaction", + params: [ + { + accessList: tx.accessList, + value: tx.value ? toHex(tx.value) : undefined, + gas: tx.gas ? toHex(tx.gas) : undefined, + from: this.address, + to: tx.to as Address, + data: tx.data, + }, + ], + })) as Hex; + + return { + transactionHash, + }; + }, + async signMessage({ message }) { + if (!wallet.provider || !account.address) { + throw new Error("Provider not setup"); + } + + const messageToSign = (() => { + if (typeof message === "string") { + return stringToHex(message); + } + if (message.raw instanceof Uint8Array) { + return toHex(message.raw); + } + return message.raw; + })(); + + return await wallet.provider.request({ + method: "personal_sign", + params: [messageToSign, account.address], + }); + }, + async signTypedData(typedData) { + if (!wallet.provider || !account.address) { + throw new Error("Provider not setup"); + } + const { domain, message, primaryType } = + typedData as unknown as SignTypedDataParameters; + + const types = { + EIP712Domain: getTypesForEIP712Domain({ domain }), + ...typedData.types, + }; + + // Need to do a runtime validation check on addresses, byte ranges, integer ranges, etc + // as we can't statically check this with TypeScript. + validateTypedData({ domain, message, primaryType, types }); + + const stringifiedData = stringify( + { domain: domain ?? {}, message, primaryType, types }, + (_, value) => (isHex(value) ? value.toLowerCase() : value), + ); + + return await wallet.provider.request({ + method: "eth_signTypedData_v4", + params: [account.address, stringifiedData], + }); + }, + }; + + this.account = account; + return account; + } + + /** + * Auto connect to saved Coinbase Wallet session + * @example + * ```ts + * await wallet.autoConnect(); + * ``` + * @returns A Promise that resolves to the connected `Account` object + */ + async autoConnect() { + const savedParams: SavedConnectParams | null = + await getSavedConnectParamsFromStorage(this.metadata.id); + + const provider = await this.initProvider({ + chainId: savedParams?.chainId, + }); + + // connected accounts + const addresses = await (provider as Ethereum).request({ + method: "eth_accounts", + }); + + const address = addresses[0]; + + if (!address) { + throw new Error("No accounts found"); + } + + const connectedChainId = (await provider.request({ + method: "eth_chainId", + })) as string | number; + this.chainId = normalizeChainId(connectedChainId); + + return this.onConnect(address); + } + + /** + * Switch chain in connected wallet + * @param chainId - The chainId to switch to + * @example + * ```ts + * await wallet.switchChain(1) + * ``` + */ + async switchChain(chainId: number) { + const provider = this.provider; + + if (!provider) { + throw new Error("Provider not initialized"); + } + + const chainIdHex = toHex(chainId); + + try { + await provider.request({ + method: "wallet_switchEthereumChain", + params: [{ chainId: chainIdHex }], + }); + } catch (error) { + const chain = await getChainDataForChainId(chainId); + + // Indicates chain is not added to provider + if ((error as any).code === 4902) { + // try to add the chain + await provider.request({ + method: "wallet_addEthereumChain", + params: [ + { + chainId: chainIdHex, + chainName: chain.name, + nativeCurrency: chain.nativeCurrency, + rpcUrls: getValidPublicRPCUrl(chain), // no client id on purpose here + blockExplorerUrls: chain.explorers?.map((x) => x.url) || [], + }, + ], + }); + } + } + } + + private async initProvider(options: CoinbaseSDKWalletConnectionOptions) { + const { CoinbaseWalletSDK } = await import("@coinbase/wallet-sdk"); + const client = new CoinbaseWalletSDK({ + ...options, + appName: this.options.appName, + }); + + if (options.onUri) { + options.onUri(client.getQrUrl()); + } + + const chainId = options?.chainId || 1; + + const chain = await getChainDataForChainId(chainId); + const jsonRpcUrl = chain?.rpc[0]; + this.provider = client.makeWeb3Provider(jsonRpcUrl, chainId); + return this.provider; + } + + private onChainChanged = (chainId: number | string) => { + this.chainId = normalizeChainId(chainId); + }; + + private onAccountsChanged = (accounts: string[]) => { + if (accounts.length === 0) { + this.onDisconnect(); + } else { + // TODO: change account + } + }; + + private onDisconnect = () => { + const provider = this.provider; + if (provider) { + provider.removeListener("accountsChanged", this.onAccountsChanged); + provider.removeListener("chainChanged", this.onChainChanged); + provider.removeListener("disconnect", this.onDisconnect); + } + + this.account = undefined; + this.chainId = undefined; + }; + + /** + * Disconnect from the Coinbase Wallet and clear the session + * @example + * ```ts + * await wallet.disconnect() + * ``` + */ + async disconnect() { + if (this.provider) { + this.provider.disconnect(); + this.provider.close(); + } + this.onDisconnect(); + } +} diff --git a/packages/thirdweb/src/wallets/index.ts b/packages/thirdweb/src/wallets/index.ts index 9ebc57fef49..d72045321c0 100644 --- a/packages/thirdweb/src/wallets/index.ts +++ b/packages/thirdweb/src/wallets/index.ts @@ -40,7 +40,6 @@ export { export { injectedCoinbaseProvider, - coinbaseMetadata, coinbaseWallet, } from "./injected/wallets/coinbase.js"; @@ -85,3 +84,10 @@ export { getStoredActiveWalletId, getStoredConnectedWalletIds, } from "./manager/index.js"; + +export { + coinbaseSDKWallet, + CoinbaseSDKWallet, + type CoinbaseSDKWalletConnectionOptions, +} from "./coinbase/coinbaseSDKWallet.js"; +export { coinbaseMetadata } from "./coinbase/coinbaseMetadata.js"; diff --git a/packages/thirdweb/src/wallets/injected/wallets/coinbase.ts b/packages/thirdweb/src/wallets/injected/wallets/coinbase.ts index e6abdb3d2c8..4e399501150 100644 --- a/packages/thirdweb/src/wallets/injected/wallets/coinbase.ts +++ b/packages/thirdweb/src/wallets/injected/wallets/coinbase.ts @@ -1,15 +1,8 @@ -import type { WalletMetadata } from "../../types.js"; +import { coinbaseMetadata } from "../../coinbase/coinbaseMetadata.js"; import { InjectedWallet } from "../index.js"; import { injectedProvider } from "../mipdStore.js"; import type { SpecificInjectedWalletOptions } from "../types.js"; -export const coinbaseMetadata: WalletMetadata = { - id: "com.coinbase.wallet", - name: "Coinbase Wallet", - iconUrl: - "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjQ4IiBoZWlnaHQ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M2NiAxOS40NTkgMjcuNDE5VjIwLjU3OUMxOS40NTkgMTkuOTYxNCAxOS45MjYyIDE5LjQ1OSAyMC41MDA2IDE5LjQ1OVoiIGZpbGw9IiMwMDUyRkYiLz4KPC9nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF8zMzAzXzg2MzQiPgo8cmVjdCB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIGZpbGw9IndoaXRlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg0IDQpIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==", -}; - /** * Connect to Injected Coinbase Wallet Provider * @param options - The options for connecting to the Injected Coinbase Wallet Provider. diff --git a/packages/thirdweb/tsconfig.base.json b/packages/thirdweb/tsconfig.base.json index e92e7f13339..2b519cac7ea 100644 --- a/packages/thirdweb/tsconfig.base.json +++ b/packages/thirdweb/tsconfig.base.json @@ -42,8 +42,6 @@ "skipLibCheck": true, // jsx for "/react" portion - "jsx": "react-jsx", - - "stripInternal": true + "jsx": "react-jsx" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f90ee3bb8f0..38bde011cd3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1402,6 +1402,9 @@ importers: packages/thirdweb: dependencies: + '@coinbase/wallet-sdk': + specifier: ^3.7.1 + version: 3.7.1 '@emotion/react': specifier: 11.11.3 version: 11.11.3(@types/react@18.2.17)(react@18.2.0) @@ -18696,7 +18699,6 @@ packages: dependencies: is-hex-prefixed: 1.0.0 strip-hex-prefix: 1.0.0 - bundledDependencies: false /event-target-shim@5.0.1: resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} @@ -21261,16 +21263,6 @@ packages: dependencies: has-symbols: 1.0.3 - /is-typed-array@1.1.10: - resolution: {integrity: sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==} - engines: {node: '>= 0.4'} - dependencies: - available-typed-arrays: 1.0.5 - call-bind: 1.0.5 - for-each: 0.3.3 - gopd: 1.0.1 - has-tostringtag: 1.0.0 - /is-typed-array@1.1.12: resolution: {integrity: sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==} engines: {node: '>= 0.4'} @@ -28912,8 +28904,8 @@ packages: inherits: 2.0.4 is-arguments: 1.1.1 is-generator-function: 1.0.10 - is-typed-array: 1.1.10 - which-typed-array: 1.1.9 + is-typed-array: 1.1.12 + which-typed-array: 1.1.13 /utils-merge@1.0.1: resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} @@ -29996,17 +29988,6 @@ packages: gopd: 1.0.1 has-tostringtag: 1.0.0 - /which-typed-array@1.1.9: - resolution: {integrity: sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==} - engines: {node: '>= 0.4'} - dependencies: - available-typed-arrays: 1.0.5 - call-bind: 1.0.5 - for-each: 0.3.3 - gopd: 1.0.1 - has-tostringtag: 1.0.0 - is-typed-array: 1.1.12 - /which@1.3.1: resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} hasBin: true