Socket
Socket
Sign inDemoInstall

@web3modal/core

Package Overview
Dependencies
Maintainers
4
Versions
374
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web3modal/core - npm Package Compare versions

Comparing version 2.2.2 to 2.3.0-6a0bdcf

dist/_types/src/controllers/WcConnectionCtrl.d.ts

3

dist/_types/index.d.ts

@@ -10,4 +10,5 @@ export { AccountCtrl } from './src/controllers/AccountCtrl';

export { ToastCtrl } from './src/controllers/ToastCtrl';
export type { ConfigCtrlState, DesktopConnectorData, InstallConnectorData, Listing, ListingResponse, MobileWallet, RouterView, SwitchNetworkData, ThemeCtrlState } from './src/types/controllerTypes';
export { WcConnectionCtrl } from './src/controllers/WcConnectionCtrl';
export type { ConfigCtrlState, Listing, ListingResponse, MobileWallet, RouterView, SwitchNetworkData, ThemeCtrlState, WalletData } from './src/types/controllerTypes';
export { CoreUtil } from './src/utils/CoreUtil';
import './src/utils/PolyfillUtil';

@@ -1,12 +0,13 @@

import type { ExplorerCtrlState, PageParams } from '../types/controllerTypes';
import type { ExplorerCtrlState, ListingParams } from '../types/controllerTypes';
export declare const ExplorerCtrl: {
state: ExplorerCtrlState;
getPreviewWallets(params: PageParams): Promise<import("../types/controllerTypes").Listing[]>;
getRecomendedWallets(): Promise<void>;
getPaginatedWallets(params: PageParams): Promise<{
getRecomendedWallets(params: ListingParams): Promise<import("../types/controllerTypes").Listing[]>;
getWallets(params: ListingParams): Promise<{
listings: import("../types/controllerTypes").Listing[];
total: number;
}>;
getImageUrl(imageId: string): string;
getInjectedWallets(): Promise<import("../types/controllerTypes").Listing[]>;
getWalletImageUrl(imageId: string): string;
getAssetImageUrl(imageId: string): string;
resetSearch(): void;
};

@@ -16,2 +16,3 @@ import type { OptionsCtrlState } from '../types/controllerTypes';

setWalletConnectVersion(walletConnectVersion: OptionsCtrlState['walletConnectVersion']): void;
setIsInjectedMobile(isInjectedMobile: OptionsCtrlState['isInjectedMobile']): void;
};

@@ -6,4 +6,6 @@ import type { RouterCtrlState } from '../types/controllerTypes';

push(view: RouterCtrlState['view'], data?: RouterCtrlState['data']): void;
reset(view: RouterCtrlState['view']): void;
replace(view: RouterCtrlState['view']): void;
goBack(): void;
setData(data: RouterCtrlState['data']): void;
};

@@ -28,2 +28,3 @@ import type { Chain, EthereumClient } from '@web3modal/ethereum';

tokenImages?: Record<string, string>;
tokenContracts?: Record<number, string>;
enableStandaloneMode?: boolean;

@@ -51,2 +52,3 @@ enableNetworkView?: boolean;

isUiLoaded: boolean;
isInjectedMobile: boolean;
walletConnectVersion: 1 | 2;

@@ -70,9 +72,9 @@ }

};
injectedWallets: Listing[];
search: ListingResponse & {
page: number;
};
previewWallets: Listing[];
recomendedWallets: Listing[];
}
export interface PageParams {
export interface ListingParams {
page?: number;

@@ -82,41 +84,34 @@ search?: string;

version?: number;
device?: 'desktop' | 'mobile';
order?: 'asc' | 'desc';
chains?: string;
}
export interface PlatformInfo {
native: string;
universal: string;
}
export interface Listing {
id: string;
name: string;
description: string;
homepage: string;
chains: string[];
versions: string[];
app_type: string;
image_id: string;
image_url: {
sm: string;
md: string;
lg: string;
};
app: {
browser: string;
ios: string;
android: string;
mac: string;
window: string;
linux: string;
browser?: string;
ios?: string;
android?: string;
mac?: string;
windows?: string;
linux?: string;
chrome?: string;
firefox?: string;
safari?: string;
edge?: string;
opera?: string;
};
mobile: PlatformInfo;
desktop: PlatformInfo;
metadata: {
shortName: string;
colors: {
primary: string;
secondary: string;
};
injected: {
injected_id: string;
namespace: string;
}[];
mobile: {
native: string;
universal: string;
};
desktop: {
native: string;
universal: string;
};
}

@@ -132,17 +127,27 @@ export interface ListingResponse {

}
export type RouterView = 'Account' | 'Connectors' | 'ConnectWallet' | 'DesktopConnector' | 'GetWallet' | 'Help' | 'InjectedConnector' | 'InstallConnector' | 'Qrcode' | 'SelectNetwork' | 'SwitchNetwork' | 'WalletExplorer';
export interface DesktopConnectorData {
export type RouterView = 'Account' | 'Connectors' | 'ConnectWallet' | 'DesktopConnecting' | 'GetWallet' | 'Help' | 'InjectedConnecting' | 'InstallWallet' | 'MobileConnecting' | 'MobileQrcodeConnecting' | 'Qrcode' | 'SelectNetwork' | 'SwitchNetwork' | 'WalletExplorer' | 'WebConnecting';
export interface WalletData {
id: string;
name: string;
native?: string;
universal?: string;
icon?: string;
walletId?: string;
homepage?: string;
image_id?: string;
app?: {
browser?: string;
ios?: string;
android?: string;
};
injected?: {
injected_id?: string;
namespace?: string;
}[];
mobile?: {
native?: string;
universal?: string;
};
desktop?: {
native?: string;
universal?: string;
};
}
export type SwitchNetworkData = Chain;
export interface InstallConnectorData {
id: string;
name: string;
url: string;
isMobile?: boolean;
}
export interface RouterCtrlState {

@@ -152,5 +157,4 @@ history: RouterView[];

data?: {
DesktopConnector?: DesktopConnectorData;
Wallet?: WalletData;
SwitchNetwork?: SwitchNetworkData;
InstallConnector?: InstallConnectorData;
};

@@ -172,2 +176,4 @@ }

'--w3m-wallet-icon-border-radius'?: string;
'--w3m-wallet-icon-large-border-radius'?: string;
'--w3m-wallet-icon-small-border-radius'?: string;
'--w3m-input-border-radius'?: string;

@@ -219,1 +225,5 @@ '--w3m-notification-border-radius'?: string;

}
export interface WcConnectionCtrlState {
pairingUri: string;
pairingError: boolean;
}

@@ -6,3 +6,3 @@ export declare const CoreUtil: {

isAndroid(): boolean;
isEmptyObject(value: unknown): boolean;
isIos(): boolean;
isHttpUrl(url: string): boolean;

@@ -15,5 +15,5 @@ formatNativeUrl(appUrl: string, wcUri: string, name: string): string;

setWalletConnectAndroidDeepLink(wcUri: string): void;
removeWalletConnectDeepLink(): void;
isNull<T>(value: T | null): value is null;
setWeb3ModalVersionInStorage(): void;
getWalletRouterData(): import("../..").WalletData;
getSwitchNetworkRouterData(): import("@wagmi/chains").Chain;
};

@@ -1,5 +0,8 @@

import type { ListingResponse, PageParams } from '../types/controllerTypes';
import type { ListingParams, ListingResponse } from '../types/controllerTypes';
export declare const ExplorerUtil: {
fetchWallets(projectId: string, params: PageParams): Promise<ListingResponse>;
formatImageUrl(projectId: string, imageId: string): string;
getDesktopListings(params: ListingParams): Promise<ListingResponse>;
getMobileListings(params: ListingParams): Promise<ListingResponse>;
getInjectedListings(params: ListingParams): Promise<ListingResponse>;
getWalletImageUrl(imageId: string): string;
getAssetImageUrl(imageId: string): string;
};

@@ -1,2 +0,2 @@

import{proxy as u,subscribe as f}from"valtio/vanilla";import{Buffer as U}from"buffer";let L;const p={ethereumClient:void 0,setEthereumClient(e){L=e},client(){if(L)return L;throw new Error("ClientCtrl has no client set")}},o=u({address:void 0,profileName:void 0,profileAvatar:void 0,profileLoading:!1,balanceLoading:!1,balance:void 0,isConnected:!1}),A={state:o,subscribe(e){return f(o,()=>e(o))},getAccount(){const e=p.client().getAccount();o.address=e.address,o.isConnected=e.isConnected},async fetchProfile(e,t){try{o.profileLoading=!0;const n=t??o.address,{id:a}=p.client().getDefaultChain();if(n&&a===1){const[l,c]=await Promise.all([p.client().fetchEnsName({address:n,chainId:1}),p.client().fetchEnsAvatar({address:n,chainId:1})]);c&&await e(c),o.profileName=l,o.profileAvatar=c}}finally{o.profileLoading=!1}},async fetchBalance(e){try{o.balanceLoading=!0;const t=e??o.address;if(t){const n=await p.client().fetchBalance({address:t});o.balance={amount:n.formatted,symbol:n.symbol}}}finally{o.balanceLoading=!1}},setAddress(e){o.address=e},setIsConnected(e){o.isConnected=e},resetBalance(){o.balance=void 0},resetAccount(){o.address=void 0,o.isConnected=!1,o.profileName=void 0,o.profileAvatar=void 0,o.balance=void 0}},d={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",W3M_VERSION:"W3M_VERSION",isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return d.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isEmptyObject(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.getOwnPropertyNames(e).length===0&&Object.getOwnPropertySymbols(e).length===0},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},formatNativeUrl(e,t,n){if(d.isHttpUrl(e))return this.formatUniversalUrl(e,t,n);let a=e;a.includes("://")||(a=e.replaceAll("/","").replaceAll(":",""),a=`${a}://`),this.setWalletConnectDeepLink(a,n);const l=encodeURIComponent(t);return`${a}wc?uri=${l}`},formatUniversalUrl(e,t,n){if(!d.isHttpUrl(e))return this.formatNativeUrl(e,t,n);let a=e;e.endsWith("/")&&(a=e.slice(0,-1)),this.setWalletConnectDeepLink(a,n);const l=encodeURIComponent(t);return`${a}/wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){localStorage.setItem(d.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))},setWalletConnectAndroidDeepLink(e){const[t]=e.split("?");localStorage.setItem(d.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))},removeWalletConnectDeepLink(){localStorage.removeItem(d.WALLETCONNECT_DEEPLINK_CHOICE)},isNull(e){return e===null},setWeb3ModalVersionInStorage(){typeof localStorage<"u"&&localStorage.setItem(d.W3M_VERSION,"2.2.2")}},s=u({selectedChain:void 0,chains:void 0,standaloneChains:void 0,standaloneUri:void 0,isStandalone:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1,walletConnectVersion:1}),i={state:s,subscribe(e){return f(s,()=>e(s))},setChains(e){s.chains=e},setStandaloneChains(e){s.standaloneChains=e},setStandaloneUri(e){s.standaloneUri=e},getSelectedChain(){const e=p.client().getNetwork().chain;return e&&(s.selectedChain=e),s.selectedChain},setSelectedChain(e){s.selectedChain=e},setIsStandalone(e){s.isStandalone=e},setIsCustomDesktop(e){s.isCustomDesktop=e},setIsCustomMobile(e){s.isCustomMobile=e},setIsDataLoaded(e){s.isDataLoaded=e},setIsUiLoaded(e){s.isUiLoaded=e},setWalletConnectVersion(e){s.walletConnectVersion=e}},b=u({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chainImages:void 0,tokenImages:void 0,standaloneChains:void 0,enableStandaloneMode:!1,enableNetworkView:!1,enableAccountView:!0,enableExplorer:!0,defaultChain:void 0,explorerAllowList:void 0,explorerDenyList:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),S={state:b,subscribe(e){return f(b,()=>e(b))},setConfig(e){var t,n,a,l;if(i.setStandaloneChains(e.standaloneChains),i.setIsStandalone(!!((t=e.standaloneChains)!=null&&t.length)||!!e.enableStandaloneMode),i.setIsCustomMobile(!!((n=e.mobileWallets)!=null&&n.length)),i.setIsCustomDesktop(!!((a=e.desktopWallets)!=null&&a.length)),i.setWalletConnectVersion((l=e.walletConnectVersion)!=null?l:1),!i.state.isStandalone){const c=p.client().getDefaultChain();i.setSelectedChain(c),i.setChains(p.client().chains)}e.defaultChain&&i.setSelectedChain(e.defaultChain),d.setWeb3ModalVersionInStorage(),Object.assign(b,e)}},W="https://explorer-api.walletconnect.com";function D(e){const t=Object.fromEntries(Object.entries(e).filter(([n,a])=>typeof a<"u"&&a!==null&&a!=="").map(([n,a])=>[n,a.toString()]));return new URLSearchParams(t).toString()}const I={async fetchWallets(e,t){const n=D(t),a=`${W}/v3/wallets?projectId=${e}&${n}`;return(await fetch(a)).json()},formatImageUrl(e,t){return`${W}/v3/logo/lg/${t}?projectId=${e}`}},h=u({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},previewWallets:[],recomendedWallets:[]});function y(){const{projectId:e}=S.state;if(!e)throw new Error("projectId is required to work with explorer api");return e}const _={state:h,async getPreviewWallets(e){const{listings:t}=await I.fetchWallets(y(),e);return h.previewWallets=Object.values(t),h.previewWallets},async getRecomendedWallets(){const{listings:e}=await I.fetchWallets(y(),{page:1,entries:6});h.recomendedWallets=Object.values(e)},async getPaginatedWallets(e){const{page:t,search:n}=e,{listings:a,total:l}=await I.fetchWallets(y(),e),c=Object.values(a),v=n?"search":"wallets";return h[v]={listings:[...h[v].listings,...c],total:l,page:t??1},{listings:c,total:l}},getImageUrl(e){return I.formatImageUrl(y(),e)},resetSearch(){h.search={listings:[],total:0,page:1}}},r=u({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),g={state:r,subscribe(e){return f(r,()=>e(r))},push(e,t){e!==r.view&&(r.view=e,t&&(r.data=t),r.history.push(e))},replace(e){r.view=e,r.history=[e]},goBack(){if(r.history.length>1){r.history.pop();const[e]=r.history.slice(-1);r.view=e}}},m=u({open:!1}),x={state:m,subscribe(e){return f(m,()=>e(m))},async open(e){return new Promise(t=>{const{isStandalone:n,isUiLoaded:a,isDataLoaded:l}=i.state,{isConnected:c}=A.state,{enableNetworkView:v}=S.state;if(n?(i.setStandaloneUri(e?.uri),i.setStandaloneChains(e?.standaloneChains),g.replace("ConnectWallet")):e!=null&&e.route?g.replace(e.route):c?g.replace("Account"):v?g.replace("SelectNetwork"):g.replace("ConnectWallet"),a&&l)m.open=!0,t();else{const N=setInterval(()=>{i.state.isUiLoaded&&i.state.isDataLoaded&&(clearInterval(N),m.open=!0,t())},200)}})},close(){m.open=!1}};var P=Object.defineProperty,E=Object.getOwnPropertySymbols,j=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable,O=(e,t,n)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M=(e,t)=>{for(var n in t||(t={}))j.call(t,n)&&O(e,n,t[n]);if(E)for(var n of E(t))k.call(t,n)&&O(e,n,t[n]);return e};function $(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const w=u({themeMode:$()?"dark":"light"}),B={state:w,subscribe(e){return f(w,()=>e(w))},setThemeConfig(e){const{themeMode:t,themeVariables:n}=e;t&&(w.themeMode=t),n&&(w.themeVariables=M({},n))}},C=u({open:!1,message:"",variant:"success"}),H={state:C,subscribe(e){return f(C,()=>e(C))},openToast(e,t){C.open=!0,C.message=e,C.variant=t},closeToast(){C.open=!1}};typeof window<"u"&&(window.Buffer||(window.Buffer=U),window.global||(window.global=window),window.process||(window.process={env:{}}));export{A as AccountCtrl,p as ClientCtrl,S as ConfigCtrl,d as CoreUtil,_ as ExplorerCtrl,x as ModalCtrl,i as OptionsCtrl,g as RouterCtrl,B as ThemeCtrl,H as ToastCtrl};
import{proxy as u,subscribe as C}from"valtio/vanilla";import{Buffer as P}from"buffer";let E;const h={ethereumClient:void 0,setEthereumClient(e){E=e},client(){if(E)return E;throw new Error("ClientCtrl has no client set")}},i=u({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),v={state:i,subscribe(e){return C(i,()=>e(i))},push(e,t){e!==i.view&&(i.view=e,t&&(i.data=t),i.history.push(e))},reset(e){i.view=e,i.history=[e]},replace(e){i.history.length>1&&(i.history[i.history.length-1]=e,i.view=e)},goBack(){if(i.history.length>1){i.history.pop();const[e]=i.history.slice(-1);i.view=e}},setData(e){i.data=e}},g={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",W3M_VERSION:"W3M_VERSION",isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return g.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return g.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},formatNativeUrl(e,t,n){if(g.isHttpUrl(e))return this.formatUniversalUrl(e,t,n);let s=e;s.includes("://")||(s=e.replaceAll("/","").replaceAll(":",""),s=`${s}://`),this.setWalletConnectDeepLink(s,n);const o=encodeURIComponent(t);return`${s}wc?uri=${o}`},formatUniversalUrl(e,t,n){if(!g.isHttpUrl(e))return this.formatNativeUrl(e,t,n);let s=e;e.endsWith("/")&&(s=e.slice(0,-1)),this.setWalletConnectDeepLink(s,n);const o=encodeURIComponent(t);return`${s}/wc?uri=${o}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){localStorage.setItem(g.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))},setWalletConnectAndroidDeepLink(e){const[t]=e.split("?");localStorage.setItem(g.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))},setWeb3ModalVersionInStorage(){typeof localStorage<"u"&&localStorage.setItem(g.W3M_VERSION,"2.3.0-6a0bdcf")},getWalletRouterData(){var e;const t=(e=v.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t},getSwitchNetworkRouterData(){var e;const t=(e=v.state.data)==null?void 0:e.SwitchNetwork;if(!t)throw new Error('Missing "SwitchNetwork" view data');return t}},r=u({selectedChain:void 0,chains:void 0,standaloneChains:void 0,standaloneUri:void 0,isStandalone:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1,isInjectedMobile:!1,walletConnectVersion:1}),l={state:r,subscribe(e){return C(r,()=>e(r))},setChains(e){r.chains=e},setStandaloneChains(e){r.standaloneChains=e},setStandaloneUri(e){r.standaloneUri=e},getSelectedChain(){const e=h.client().getNetwork().chain;return e&&(r.selectedChain=e),r.selectedChain},setSelectedChain(e){r.selectedChain=e},setIsStandalone(e){r.isStandalone=e},setIsCustomDesktop(e){r.isCustomDesktop=e},setIsCustomMobile(e){r.isCustomMobile=e},setIsDataLoaded(e){r.isDataLoaded=e},setIsUiLoaded(e){r.isUiLoaded=e},setWalletConnectVersion(e){r.walletConnectVersion=e},setIsInjectedMobile(e){r.isInjectedMobile=e}},y=u({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chainImages:void 0,tokenImages:void 0,tokenContracts:void 0,standaloneChains:void 0,enableStandaloneMode:!1,enableNetworkView:!1,enableAccountView:!0,enableExplorer:!0,defaultChain:void 0,explorerAllowList:void 0,explorerDenyList:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),L={state:y,subscribe(e){return C(y,()=>e(y))},setConfig(e){var t,n,s,o;l.setStandaloneChains(e.standaloneChains),l.setIsStandalone(!!((t=e.standaloneChains)!=null&&t.length)||!!e.enableStandaloneMode),l.setIsCustomMobile(!!((n=e.mobileWallets)!=null&&n.length)),l.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),l.setWalletConnectVersion((o=e.walletConnectVersion)!=null?o:1),l.state.isStandalone||(l.setChains(h.client().chains),l.setIsInjectedMobile(g.isMobile()&&h.client().isInjectedProviderInstalled())),e.defaultChain&&l.setSelectedChain(e.defaultChain),g.setWeb3ModalVersionInStorage(),Object.assign(y,e)}},a=u({address:void 0,profileName:void 0,profileAvatar:void 0,profileLoading:!1,balanceLoading:!1,balance:void 0,isConnected:!1}),$={state:a,subscribe(e){return C(a,()=>e(a))},getAccount(){const e=h.client().getAccount();a.address=e.address,a.isConnected=e.isConnected},async fetchProfile(e,t){var n;try{a.profileLoading=!0;const s=t??a.address,o=(n=l.state.chains)==null?void 0:n.find(c=>c.id===1);if(s&&o){const[c,d]=await Promise.all([h.client().fetchEnsName({address:s,chainId:1}),h.client().fetchEnsAvatar({address:s,chainId:1})]);d&&await e(d),a.profileName=c,a.profileAvatar=d}}finally{a.profileLoading=!1}},async fetchBalance(e){try{const{chain:t}=h.client().getNetwork(),{tokenContracts:n}=L.state;let s;t&&n&&(s=n[t.id]),a.balanceLoading=!0;const o=e??a.address;if(o){const c=await h.client().fetchBalance({address:o,token:s});a.balance={amount:c.formatted,symbol:c.symbol}}}finally{a.balanceLoading=!1}},setAddress(e){a.address=e},setIsConnected(e){a.isConnected=e},resetBalance(){a.balance=void 0},resetAccount(){a.address=void 0,a.isConnected=!1,a.profileName=void 0,a.profileAvatar=void 0,a.balance=void 0}},U="https://explorer-api.walletconnect.com";async function S(e,t){const n=new URL(e,U);return n.searchParams.append("projectId",L.state.projectId),Object.entries(t).forEach(([s,o])=>{o&&n.searchParams.append(s,String(o))}),(await fetch(n)).json()}const w={async getDesktopListings(e){return S("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return S("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return S("/w3m/v1/getInjectedListings",e)},getWalletImageUrl(e){return`${U}/w3m/v1/getWalletImage/${e}?projectId=${L.state.projectId}`},getAssetImageUrl(e){return`${U}/w3m/v1/getAssetImage/${e}?projectId=${L.state.projectId}`}},M=g.isMobile(),p=u({wallets:{listings:[],total:0,page:1},injectedWallets:[],search:{listings:[],total:0,page:1},recomendedWallets:[]}),K={state:p,async getRecomendedWallets(e){const{listings:t}=M?await w.getMobileListings(e):await w.getDesktopListings(e);return p.recomendedWallets=Object.values(t),p.recomendedWallets},async getWallets(e){const{page:t,search:n}=e,{listings:s,total:o}=M?await w.getMobileListings(e):await w.getDesktopListings(e),c=Object.values(s),d=n?"search":"wallets";return p[d]={listings:[...p[d].listings,...c],total:o,page:t??1},{listings:c,total:o}},async getInjectedWallets(){const{listings:e}=await w.getInjectedListings({}),t=Object.values(e);return p.injectedWallets=t,p.injectedWallets},getWalletImageUrl(e){return w.getWalletImageUrl(e)},getAssetImageUrl(e){return w.getAssetImageUrl(e)},resetSearch(){p.search={listings:[],total:0,page:1}}},f=u({pairingUri:"",pairingError:!1}),N={state:f,subscribe(e){return C(f,()=>e(f))},setPairingUri(e){f.pairingUri=e},setPairingError(e){f.pairingError=e}},b=u({open:!1}),J={state:b,subscribe(e){return C(b,()=>e(b))},async open(e){return new Promise(t=>{const{isStandalone:n,isUiLoaded:s,isDataLoaded:o}=l.state,{pairingUri:c}=N.state,{isConnected:d}=$.state,{enableNetworkView:A}=L.state;if(n?(l.setStandaloneUri(e?.uri),l.setStandaloneChains(e?.standaloneChains),v.reset("ConnectWallet")):e!=null&&e.route?v.reset(e.route):d?v.reset("Account"):A?v.reset("SelectNetwork"):v.reset("ConnectWallet"),s&&o&&(n||c||d))b.open=!0,t();else{const O=setInterval(()=>{const W=l.state,D=N.state;W.isUiLoaded&&W.isDataLoaded&&(W.isStandalone||D.pairingUri||d)&&(clearInterval(O),b.open=!0,t())},200)}})},close(){b.open=!1}};var V=Object.defineProperty,k=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,j=(e,t,n)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R=(e,t)=>{for(var n in t||(t={}))T.call(t,n)&&j(e,n,t[n]);if(k)for(var n of k(t))_.call(t,n)&&j(e,n,t[n]);return e};function B(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const I=u({themeMode:B()?"dark":"light"}),q={state:I,subscribe(e){return C(I,()=>e(I))},setThemeConfig(e){const{themeMode:t,themeVariables:n}=e;t&&(I.themeMode=t),n&&(I.themeVariables=R({},n))}},m=u({open:!1,message:"",variant:"success"}),z={state:m,subscribe(e){return C(m,()=>e(m))},openToast(e,t){m.open=!0,m.message=e,m.variant=t},closeToast(){m.open=!1}};typeof window<"u"&&(window.Buffer||(window.Buffer=P),window.global||(window.global=window),window.process||(window.process={env:{}}));export{$ as AccountCtrl,h as ClientCtrl,L as ConfigCtrl,g as CoreUtil,K as ExplorerCtrl,J as ModalCtrl,l as OptionsCtrl,v as RouterCtrl,q as ThemeCtrl,z as ToastCtrl,N as WcConnectionCtrl};
//# sourceMappingURL=index.js.map
{
"name": "@web3modal/core",
"version": "2.2.2",
"version": "2.3.0-6a0bdcf",
"main": "dist/index.js",

@@ -20,6 +20,6 @@ "type": "module",

"buffer": "6.0.3",
"valtio": "1.10.3"
"valtio": "1.10.4"
},
"devDependencies": {
"@web3modal/ethereum": "2.2.2"
"@web3modal/ethereum": "2.3.0-6a0bdcf"
},

@@ -26,0 +26,0 @@ "keywords": [

@@ -1,5 +0,9 @@

### ๐Ÿ“š [Documentation](https://docs.walletconnect.com/2.0/introduction/web3modal/about)
> Looking for v1.x readme? It is available on [V1 Branch](https://github.com/WalletConnect/web3modal/tree/V1)
### ๐Ÿ–ฅ๏ธ [Minimal Example](https://web3modal-dev.pages.dev/)
### ๐Ÿ“š [Documentation](https://docs.walletconnect.com/2.0/web3modal/about)
### ๐Ÿ”Ž [Examples](https://github.com/WalletConnect/web3modal-examples)
### ๐Ÿงช [Laboratory](https://lab.web3modal.com)
### ๐Ÿ”— [Website](https://web3modal.com)

@@ -15,7 +19,4 @@

## Getting Started
## Development
- [React Docs](https://docs.walletconnect.com/2.0/introduction/web3modal/react/installation) / [React Example](./examples/react/)
- [Vanilla JS Docs](https://docs.walletconnect.com/2.0/web3modal/html-js/installation) / [Vanila JS Example](./examples/html/)
- Vue Docs / Vue Example (coming soon)
- Angular Docs / Angular Example (coming soon)
Please follow [developer docs](./.github/docs/development.md) to set up web3modal locally.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc