@web3modal/core
Advanced tools
Comparing version 2.0.0-buffer1 to 2.0.0-c2564bd
@@ -1,13 +0,11 @@ | ||
export { AccountCtrl, initialAccountlState } from './src/controllers/AccountCtrl'; | ||
export { ClientCtrl } from './src/controllers/ClientCtrl'; | ||
export { ConfigCtrl } from './src/controllers/ConfigCtrl'; | ||
export { ConnectModalCtrl } from './src/controllers/ConnectModalCtrl'; | ||
export { ExplorerCtrl } from './src/controllers/ExplorerCtrl'; | ||
export { ModalToastCtrl } from './src/controllers/ModalToastCtrl'; | ||
export { ModalCtrl } from './src/controllers/ModalCtrl'; | ||
export { OptionsCtrl } from './src/controllers/OptionsCtrl'; | ||
export { RouterCtrl } from './src/controllers/RouterCtrl'; | ||
export { ToastCtrl } from './src/controllers/ToastCtrl'; | ||
export type { ConfigOptions, Listing, ListingResponse, RouterView } from './src/types/controllerTypes'; | ||
export { CoreHelpers } from './src/utils/CoreHelpers'; | ||
export { getExplorerApi } from './src/utils/ExplorerApi'; | ||
export type { Account } from './types/accountTypes'; | ||
export type { ConfigOptions } from './types/configTypes'; | ||
export type { Listing } from './types/explorerTypes'; | ||
export type { RouterView } from './types/routerTypes'; | ||
import './src/utils/PolyfillUtil'; |
@@ -1,41 +0,5 @@ | ||
import type { EthereumClient, Web3ModalEthereum } from '@web3modal/ethereum'; | ||
export interface State { | ||
ethereum?: typeof Web3ModalEthereum; | ||
} | ||
import type { ClientCtrlState } from '../types/controllerTypes'; | ||
export declare const ClientCtrl: { | ||
ethereum(): { | ||
walletConnectRpc({ projectId }: import("@web3modal/ethereum/dist/_types/types/apiTypes").GetWalletConnectProviderOpts): import("@wagmi/core").ChainProviderFn<import("@ethersproject/providers").JsonRpcProvider, import("@ethersproject/providers").WebSocketProvider, import("@wagmi/core").Chain>; | ||
defaultConnectors({ appName, chains }: import("@web3modal/ethereum/dist/_types/types/apiTypes").GetDefaultConnectorsOpts): (import("@wagmi/core/connectors/walletConnect").WalletConnectConnector | import("@wagmi/core").InjectedConnector | import("@wagmi/core/connectors/coinbaseWallet").CoinbaseWalletConnector)[]; | ||
createClient(wagmiClient: EthereumClient): any; | ||
getDefaultConnectorChainId(connector: import("@wagmi/core").Connector<any, any, any>): number; | ||
getConnectorById(id: "coinbaseWallet" | "injected" | "metaMask" | "walletConnect"): import("@wagmi/core").Connector<any, any, any>; | ||
disconnect(): Promise<void>; | ||
connectWalletConnect(onUri: (uri: string) => void): Promise<import("@wagmi/core").ConnectResult<import("@wagmi/core").Provider>>; | ||
connectLinking(onUri: (uri: string) => void): Promise<import("@wagmi/core").ConnectResult<import("@wagmi/core").Provider>>; | ||
connectCoinbaseMobile(onUri?: ((uri: string) => void) | undefined): Promise<import("@wagmi/core").ConnectResult<import("@wagmi/core").Provider>>; | ||
connectCoinbaseExtension(): Promise<import("@wagmi/core").ConnectResult<import("@wagmi/core").Provider>>; | ||
connectMetaMask(): Promise<import("@wagmi/core").ConnectResult<import("@wagmi/core").Provider>>; | ||
connectInjected(): Promise<import("@wagmi/core").ConnectResult<import("@wagmi/core").Provider>>; | ||
switchChain(chainId: string): Promise<string>; | ||
signTypedData({ value, domain, types }: import("@web3modal/ethereum").SignTypedDataOpts): Promise<string>; | ||
signMessage(message: string): Promise<string>; | ||
fetchBalance(opts: import("@web3modal/ethereum").GetBalanceOpts): Promise<string>; | ||
fetchSigner(): Promise<import("@wagmi/core").FetchSignerResult<import("ethers").Signer>>; | ||
getNetwork(): import("@wagmi/core").GetNetworkResult; | ||
getContract({ addressOrName, contractInterface, signerOrProvider }: import("@web3modal/ethereum").GetContractOpts): import("ethers").Contract; | ||
getToken({ address, chainId, formatUnits }: import("@web3modal/ethereum").GetTokenOpts): Promise<import("@wagmi/core").FetchTokenResult>; | ||
readContract(opts: import("@web3modal/ethereum").ContractOpts): Promise<import("@ethersproject/abi").Result>; | ||
writeContract(opts: import("@web3modal/ethereum").WriteContractOpts): Promise<import("@wagmi/core").SendTransactionResult>; | ||
prepareWriteContract(opts: import("@web3modal/ethereum").PrepareWriteContractOpts): Promise<import("@wagmi/core").PrepareWriteContractResult<import("ethers").Signer>>; | ||
watchReadContract(opts: import("@web3modal/ethereum").WatchReadContractOpts): void; | ||
fetchEnsAddress(opts: import("@web3modal/ethereum").FetchEnsAddressOpts): Promise<string | undefined>; | ||
fetchEnsAvatar(opts: import("@web3modal/ethereum").FetchEnsAvatarOpts): Promise<string | undefined>; | ||
fetchEnsName(opts: import("@web3modal/ethereum").FetchEnsNameOpts): Promise<string | undefined>; | ||
fetchEnsResolver(opts: import("@web3modal/ethereum").FetchEnsAddressOpts): Promise<import("@wagmi/core").FetchEnsResolverResult>; | ||
fetchTransaction(opts: import("@web3modal/ethereum").FetchTransactionOpts): Promise<import("@ethersproject/abstract-provider").TransactionResponse>; | ||
prepareSendTransaction(opts: import("@web3modal/ethereum").PrepareSendTransactionOpts): Promise<import("@wagmi/core").PrepareSendTransactionResult>; | ||
sendTransaction(opts: import("@web3modal/ethereum").PrepareSendTransactionOpts): Promise<import("@wagmi/core").SendTransactionResult>; | ||
waitForTransaction(opts: import("@web3modal/ethereum").WaitForTransactionOpts): Promise<import("@ethersproject/abstract-provider").TransactionReceipt>; | ||
}; | ||
setEthereumClient(ethereumClient: EthereumClient): Promise<void>; | ||
setEthereumClient(ethereumClient: ClientCtrlState['ethereumClient']): void; | ||
client(): import("@web3modal/ethereum").EthereumClient; | ||
}; |
@@ -1,9 +0,6 @@ | ||
import type { ConfigOptions } from '../../types/configTypes'; | ||
export interface State extends ConfigOptions { | ||
configured: boolean; | ||
} | ||
import type { ConfigCtrlState, ConfigOptions } from '../types/controllerTypes'; | ||
export declare const ConfigCtrl: { | ||
state: State; | ||
subscribe(callback: (newState: State) => void): () => void; | ||
state: ConfigCtrlState; | ||
subscribe(callback: (newState: ConfigCtrlState) => void): () => boolean; | ||
setConfig(config: ConfigOptions): void; | ||
}; |
@@ -1,16 +0,12 @@ | ||
import type { Listing, ListingResponse, PageParams } from '../../types/explorerTypes'; | ||
export interface State { | ||
search: string; | ||
page: number; | ||
wallets: ListingResponse; | ||
previewWallets: Listing[]; | ||
} | ||
import type { ExplorerCtrlState, PageParams } from '../types/controllerTypes'; | ||
export declare const ExplorerCtrl: { | ||
state: State; | ||
subscribe(callback: (newState: State) => void): () => void; | ||
getPreviewWallets(): Promise<Listing[]>; | ||
state: ExplorerCtrlState; | ||
subscribe(callback: (newState: ExplorerCtrlState) => void): () => boolean; | ||
getPreviewWallets(params: PageParams): Promise<import("../types/controllerTypes").Listing[]>; | ||
getRecomendedWallets(): Promise<void>; | ||
getPaginatedWallets(params: PageParams): Promise<{ | ||
listings: Listing[]; | ||
listings: import("../types/controllerTypes").Listing[]; | ||
total: number; | ||
}>; | ||
resetSearch(): void; | ||
}; |
@@ -1,12 +0,8 @@ | ||
import type { RouterView } from '../../types/routerTypes'; | ||
export interface State { | ||
history: RouterView[]; | ||
view: RouterView; | ||
} | ||
import type { RouterCtrlState } from '../types/controllerTypes'; | ||
export declare const RouterCtrl: { | ||
state: State; | ||
subscribe(callback: (newState: State) => void): () => void; | ||
push(view: State['view']): void; | ||
replace(view: State['view']): void; | ||
state: RouterCtrlState; | ||
subscribe(callback: (newState: RouterCtrlState) => void): () => boolean; | ||
push(view: RouterCtrlState['view'], data?: RouterCtrlState['data']): void; | ||
replace(view: RouterCtrlState['view']): void; | ||
goBack(): void; | ||
}; |
export declare const CoreHelpers: { | ||
isCoinbaseExtension(): import("@coinbase/wallet-sdk").CoinbaseWalletProvider | undefined; | ||
isMobile(): boolean; | ||
formatNativeUrl(appUrl: string, encodedWcUrl: string, name: string): string; | ||
formatUniversalUrl(appUrl: string, encodedWcUrl: string, name: string): string; | ||
isEmptyObject(value: unknown): boolean; | ||
formatNativeUrl(appUrl: string, wcUri: string, name: string): string; | ||
formatUniversalUrl(appUrl: string, wcUri: string, name: string): string; | ||
wait(miliseconds: number): Promise<unknown>; | ||
@@ -10,2 +11,3 @@ openHref(href: string, target?: string): void; | ||
removeWalletConnectDeepLink(): void; | ||
isNull<T>(value: T | null): value is null; | ||
}; |
@@ -1,2 +0,2 @@ | ||
import type { ListingResponse, PageParams } from '../../types/explorerTypes'; | ||
import type { ListingResponse, PageParams } from '../types/controllerTypes'; | ||
export declare function getExplorerApi(): { | ||
@@ -3,0 +3,0 @@ url: string; |
@@ -1,2 +0,2 @@ | ||
import{proxy as c,subscribe as l}from"valtio/vanilla";const f={connected:!1,chainSupported:!1,address:"",chainId:"",connector:""},a=c(f),j={state:a,subscribe(e){return l(a,()=>e(a))},setAccount(e){Object.assign(a,e),a.connected=!0},setAddress(e){a.address=e},setChain(e,t){a.chainId=e,a.chainSupported=t},resetAccount(){Object.assign(a,f)}},w=c({ethereum:void 0}),I={ethereum(){if(!w.ethereum)throw new Error("Ethereum client was not provided");return w.ethereum},async setEthereumClient(e){const{Web3ModalEthereum:t}=await import("@web3modal/ethereum");w.ethereum=t.createClient(e)}};function C(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const u=c({configured:!1,projectId:"",theme:C()?"dark":"light",accentColor:"default"}),b={state:u,subscribe(e){return l(u,()=>e(u))},setConfig(e){if(!e.projectId)throw new Error("Web3Modal requires projectId that can be obtained at cloud.walletconnect.com");Object.assign(u,e),u.configured=!0}},p=c({open:!1}),O={state:p,subscribe(e){return l(p,()=>e(p))},openModal(){p.open=!0},closeModal(){p.open=!1}};function E(){return{url:"https://explorer-api.walletconnect.com",projectId:b.state.projectId}}function v(e){const t=Object.fromEntries(Object.entries(e).map(([s,n])=>[s,n.toString()]));return new URLSearchParams(t).toString()}function W(e){const{url:t,projectId:s}=E();return`${t}/v3/wallets?projectId=${s}&${v(e)}`}async function g(e){return(await fetch(W(e))).json()}const r=c({search:"",page:1,wallets:{listings:[],total:0},previewWallets:[]}),$={state:r,subscribe(e){return l(r,()=>e(r))},async getPreviewWallets(){const{listings:e}=await g({page:1,entries:10,version:1});return r.previewWallets=Object.values(e),r.previewWallets},async getPaginatedWallets(e){const{listings:t,total:s}=await g(e),n=Object.values(t);r.wallets={listings:[...r.wallets.listings,...n],total:s};const{page:d,search:h}=e;return typeof d<"u"&&r.page!==d&&(r.page=d),typeof h<"u"&&r.search!==h&&(r.search=h),{listings:n,total:s}}},i=c({open:!1,message:""}),A={state:i,subscribe(e){return l(i,()=>e(i))},openToast(e){i.open=!0,i.message=e},closeToast(){i.open=!1}},o=c({history:["ConnectWallet"],view:"ConnectWallet"}),L={state:o,subscribe(e){return l(o,()=>e(o))},push(e){o.view=e,o.history.push(e)},replace(e){o.view=e,o.history=[e]},goBack(){if(o.history.length>1){o.history.pop();const[e]=o.history.slice(-1);o.view=e}}},m="WALLETCONNECT_DEEPLINK_CHOICE",M={isCoinbaseExtension(){return window.coinbaseWalletExtension},isMobile(){return Boolean(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent))},formatNativeUrl(e,t,s){const n=e.replaceAll("/","").replaceAll(":","");return this.setWalletConnectDeepLink(n,s),`${n}://wc?uri=${t}`},formatUniversalUrl(e,t,s){let n=e;return e.endsWith("/")&&(n=e.slice(0,-1)),this.setWalletConnectDeepLink(n,s),`${n}/wc?uri=${t}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t="_self"){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){localStorage.setItem(m,JSON.stringify({href:e,name:t}))},removeWalletConnectDeepLink(){localStorage.removeItem(m)}};export{j as AccountCtrl,I as ClientCtrl,b as ConfigCtrl,O as ConnectModalCtrl,M as CoreHelpers,$ as ExplorerCtrl,A as ModalToastCtrl,L as RouterCtrl,E as getExplorerApi,f as initialAccountlState}; | ||
import{proxy as i,subscribe as w}from"valtio/vanilla";import{Buffer as v}from"buffer";const c=i({selectedChainId:void 0,chains:void 0,standaloneChains:void 0,standaloneUri:void 0}),h={state:c,setChains(e){c.chains=e},setStandaloneChains(e){c.standaloneChains=e},setStandaloneUri(e){c.standaloneUri=e},setSelectedChainId(e){c.selectedChainId=e}},d=i({initialized:!1,ethereumClient:void 0}),S={setEthereumClient(e){!d.initialized&&e&&(d.ethereumClient=e,h.setChains(e.chains),d.initialized=!0)},client(){if(d.ethereumClient)return d.ethereumClient;throw new Error("ClientCtrl has no client set")}};function y(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const p=i({configured:!1,projectId:"",theme:y()?"dark":"light",accentColor:"default",standaloneChains:void 0}),O={state:p,subscribe(e){return w(p,()=>e(p))},setConfig(e){var t;if(!e.projectId)throw new Error("Web3Modal requires projectId that can be obtained at cloud.walletconnect.com");(t=e.standaloneChains)!=null&&t.length&&h.setStandaloneChains(e.standaloneChains),Object.assign(p,e),p.configured=!0}};function W(e){const t=Object.fromEntries(Object.entries(e).filter(([o,n])=>typeof n<"u"&&n!==null&&n!=="").map(([o,n])=>[o,n.toString()]));return new URLSearchParams(t).toString()}function j(){return{url:"https://explorer-api.walletconnect.com",projectId:O.state.projectId}}async function C(e){const{url:t,projectId:o}=j(),n=`${t}/v3/wallets?projectId=${o}&${W(e)}`;return(await fetch(n)).json()}const a=i({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},previewWallets:[],recomendedWallets:[]}),P={state:a,subscribe(e){return w(a,()=>e(a))},async getPreviewWallets(e){const{listings:t}=await C(e);return a.previewWallets=Object.values(t),a.previewWallets},async getRecomendedWallets(){const{listings:e}=await C({page:1,entries:6});a.recomendedWallets=Object.values(e)},async getPaginatedWallets(e){const{page:t,search:o}=e,{listings:n,total:l}=await C(e),g=Object.values(n),f=o?"search":"wallets";return a[f]={listings:[...a[f].listings,...g],total:l,page:t??1},{listings:g,total:l}},resetSearch(){a.search={listings:[],total:0,page:1}}},s=i({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),m={state:s,subscribe(e){return w(s,()=>e(s))},push(e,t){e!==s.view&&(s.view=e,t&&(s.data=t),s.history.push(e))},replace(e){s.view=e,s.history=[e]},goBack(){if(s.history.length>1){s.history.pop();const[e]=s.history.slice(-1);s.view=e}}},u=i({open:!1}),L={state:u,subscribe(e){return w(u,()=>e(u))},open(e){var t;const{chains:o}=h.state;o!=null&&o.length&&o.length>1?m.replace("SelectNetwork"):m.replace("ConnectWallet"),typeof e?.uri=="string"&&h.setStandaloneUri(e.uri),(t=e?.standaloneChains)!=null&&t.length&&h.setStandaloneChains(e.standaloneChains),u.open=!0},close(){u.open=!1}},r=i({open:!1,message:"",variant:"success"}),N={state:r,subscribe(e){return w(r,()=>e(r))},openToast(e,t){r.open=!0,r.message=e,r.variant=t},closeToast(){r.open=!1}},b="WALLETCONNECT_DEEPLINK_CHOICE",$={isCoinbaseExtension(){return window.coinbaseWalletExtension},isMobile(){return Boolean(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent))},isEmptyObject(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.getOwnPropertyNames(e).length===0&&Object.getOwnPropertySymbols(e).length===0},formatNativeUrl(e,t,o){const n=e.replaceAll("/","").replaceAll(":","");this.setWalletConnectDeepLink(n,o);const l=encodeURIComponent(t);return`${n}://wc?uri=${l}`},formatUniversalUrl(e,t,o){let n=e;e.endsWith("/")&&(n=e.slice(0,-1)),this.setWalletConnectDeepLink(n,o);const l=encodeURIComponent(t);return`${n}/wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t="_self"){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){localStorage.setItem(b,JSON.stringify({href:e,name:t}))},removeWalletConnectDeepLink(){localStorage.removeItem(b)},isNull(e){return e===null}};typeof window<"u"&&(window.Buffer||(window.Buffer=v),window.global||(window.global=window),window.process||(window.process={env:{}}));export{S as ClientCtrl,O as ConfigCtrl,$ as CoreHelpers,P as ExplorerCtrl,L as ModalCtrl,h as OptionsCtrl,m as RouterCtrl,N as ToastCtrl,j as getExplorerApi}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@web3modal/core", | ||
"version": "2.0.0-buffer1", | ||
"version": "2.0.0-c2564bd", | ||
"main": "dist/index.js", | ||
"unpkg": "dist/index.umd.js", | ||
"type": "module", | ||
@@ -15,3 +14,3 @@ "types": "dist/_types/index.d.ts", | ||
"build:source": "rollup --silent --config rollup.config.js", | ||
"build": "npm run build:clean; npm run build:types; npm run build:source", | ||
"build": "npm run build:clean; npm run build:types & npm run build:source", | ||
"dev": "rollup --config rollup.config.js --watch", | ||
@@ -21,15 +20,8 @@ "typecheck": "tsc --noEmit" | ||
"dependencies": { | ||
"valtio": "1.7.0" | ||
"buffer": "6.0.3", | ||
"valtio": "1.7.5" | ||
}, | ||
"devDependencies": { | ||
"@web3modal/ethereum": "2.0.0-buffer1" | ||
"@web3modal/ethereum": "2.0.0-c2564bd" | ||
}, | ||
"peerDependencies": { | ||
"@web3modal/ethereum": "*" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@web3modal/ethereum": { | ||
"optional": true | ||
} | ||
}, | ||
"keywords": [ | ||
@@ -44,3 +36,3 @@ "web3", | ||
"author": "WalletConnect <walletconnect.com>", | ||
"license": "MIT", | ||
"license": "Apache-2.0", | ||
"homepage": "https://github.com/web3modal/web3modal", | ||
@@ -47,0 +39,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
28450
16
205
2
133
+ Addedbuffer@6.0.3
+ Addedbase64-js@1.5.1(transitive)
+ Addedbuffer@6.0.3(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedvaltio@1.7.5(transitive)
- Removed@adraffy/ens-normalize@1.11.0(transitive)
- Removed@noble/curves@1.8.1(transitive)
- Removed@noble/hashes@1.7.1(transitive)
- Removed@scure/base@1.2.4(transitive)
- Removed@scure/bip32@1.6.2(transitive)
- Removed@scure/bip39@1.5.4(transitive)
- Removed@wagmi/core@2.16.3(transitive)
- Removed@web3modal/ethereum@2.7.1(transitive)
- Removedabitype@1.0.8(transitive)
- Removedeventemitter3@5.0.1(transitive)
- Removedisows@1.0.6(transitive)
- Removedmipd@0.0.7(transitive)
- Removedox@0.6.7(transitive)
- Removedvaltio@1.7.0(transitive)
- Removedviem@2.22.14(transitive)
- Removedws@8.18.0(transitive)
- Removedzustand@5.0.0(transitive)
Updatedvaltio@1.7.5