@web3modal/core
Advanced tools
Comparing version 2.0.0-6ce38ab to 2.0.0-a38e60a
@@ -1,13 +0,24 @@ | ||
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 { RouterCtrl } from './src/controllers/RouterCtrl'; | ||
export { ClientCtrl } from './src/controllers/statefull/ClientCtrl'; | ||
export { ConfigCtrl } from './src/controllers/statefull/ConfigCtrl'; | ||
export { ExplorerCtrl } from './src/controllers/statefull/ExplorerCtrl'; | ||
export { ModalCtrl } from './src/controllers/statefull/ModalCtrl'; | ||
export { OptionsCtrl } from './src/controllers/statefull/OptionsCtrl'; | ||
export { RouterCtrl } from './src/controllers/statefull/RouterCtrl'; | ||
export { ToastCtrl } from './src/controllers/statefull/ToastCtrl'; | ||
export { AccountCtrl } from './src/controllers/stateless/AccountCtrl'; | ||
export { BalanceCtrl } from './src/controllers/stateless/BalanceCtrl'; | ||
export { BlockCtrl } from './src/controllers/stateless/BlockCtrl'; | ||
export { ContractCtrl } from './src/controllers/stateless/ContractCtrl'; | ||
export { EnsCtrl } from './src/controllers/stateless/EnsCtrl'; | ||
export { FeeCtrl } from './src/controllers/stateless/FeeCtrl'; | ||
export { NetworkCtrl } from './src/controllers/stateless/NetworkCtrl'; | ||
export { ProviderCtrl } from './src/controllers/stateless/ProviderCtrl'; | ||
export { SignerCtrl } from './src/controllers/stateless/SignerCtrl'; | ||
export { TokenCtrl } from './src/controllers/stateless/TokenCtrl'; | ||
export { TransactionCtrl } from './src/controllers/stateless/TransactionCtrl'; | ||
export { WebSocketProviderCtrl } from './src/controllers/stateless/WebSocketProviderCtrl'; | ||
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'; | ||
export type { ConfigOptions, Listing, ListingResponse, RouterView } from './types/statefullCtrlTypes'; | ||
export type { AccountCtrlGetReturnValue, BalanceCtrlFetchArgs, BalanceCtrlFetchReturnValue, ContractCtrlGetArgs, ContractCtrlReadArgs, ContractCtrlWatchEventArgs, ContractCtrlWriteArgs, EnsCtrlFetchEnsAddressArgs, EnsCtrlFetchEnsAvatarArgs, EnsCtrlFetchEnsNameArgs, EnsCtrlFetchEnsResolverArgs, FeeCtrlFetchArgs, FeeCtrlFetchReturnValue, NetworkCtrlGetReturnValue, NetworkCtrlSwitchNetworkArgs, SignerCtrlSignMessageArgs, SignerCtrlSignTypedDataArgs, TokenCtrlFetchArgs, TransactionCtrlFetchArgs, TransactionCtrlSendArgs, TransactionCtrlWaitArgs } from './types/statelessCtrlTypes'; | ||
import './src/utils/PolyfillUtil'; |
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/statefullCtrlTypes'; | ||
export declare function getExplorerApi(): { | ||
@@ -3,0 +3,0 @@ url: string; |
@@ -1,2 +0,2 @@ | ||
import{Buffer as C}from"buffer";import{proxy as a,subscribe as l}from"valtio/vanilla";const g={connected:!1,chainSupported:!1,address:"",chainId:"",connector:""},i=a(g),O={state:i,subscribe(e){return l(i,()=>e(i))},setAccount(e){Object.assign(i,e),i.connected=!0},setAddress(e){i.address=e},setChain(e,t){i.chainId=e,i.chainSupported=t},resetAccount(){Object.assign(i,g)}},w=a({ethereum:void 0}),$={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 b(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const u=a({configured:!1,projectId:"",theme:b()?"dark":"light",accentColor:"default"}),E={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=a({open:!1}),A={state:p,subscribe(e){return l(p,()=>e(p))},openModal(){p.open=!0},closeModal(){p.open=!1}};function v(){return{url:"https://explorer-api.walletconnect.com",projectId:E.state.projectId}}function y(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}=v();return`${t}/v3/wallets?projectId=${s}&${y(e)}`}async function f(e){return(await fetch(W(e))).json()}const r=a({search:"",page:1,wallets:{listings:[],total:0},previewWallets:[]}),L={state:r,subscribe(e){return l(r,()=>e(r))},async getPreviewWallets(){const{listings:e}=await f({page:1,entries:10,version:1});return r.previewWallets=Object.values(e),r.previewWallets},async getPaginatedWallets(e){const{listings:t,total:s}=await f(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}}},c=a({open:!1,message:""}),M={state:c,subscribe(e){return l(c,()=>e(c))},openToast(e){c.open=!0,c.message=e},closeToast(){c.open=!1}},o=a({history:["ConnectWallet"],view:"ConnectWallet"}),S={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",P={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)}};typeof window<"u"&&!window.Buffer&&(window.Buffer=C);export{O as AccountCtrl,$ as ClientCtrl,E as ConfigCtrl,A as ConnectModalCtrl,P as CoreHelpers,L as ExplorerCtrl,M as ModalToastCtrl,S as RouterCtrl,v as getExplorerApi,g as initialAccountlState}; | ||
import{proxy as u,subscribe as p}from"valtio/vanilla";import{Buffer as W}from"buffer";const d=u({selectedChainId:void 0,chains:void 0,standaloneChains:void 0,standaloneUri:void 0}),l={state:d,setChains(e){d.chains=e},setStandaloneChains(e){d.standaloneChains=e},setStandaloneUri(e){d.standaloneUri=e},setSelectedChainId(e){d.selectedChainId=e}},c=u({initialized:!1,ethereum:void 0}),n={state:c,subscribe(e){return p(c,()=>e(c))},ethereum(){if(!c.ethereum)throw new Error("Ethereum client was not provided");return c.ethereum},setEthereumClient(e){!c.initialized&&e&&(c.ethereum=e,l.setChains(e.chains),c.initialized=!0)}};function I(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const w=u({configured:!1,projectId:"",theme:I()?"dark":"light",accentColor:"default",standaloneChains:void 0}),N={state:w,subscribe(e){return p(w,()=>e(w))},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&&l.setStandaloneChains(e.standaloneChains),Object.assign(w,e),w.configured=!0}};function T(e){const t=Object.fromEntries(Object.entries(e).filter(([r,a])=>typeof a<"u"&&a!==null&&a!=="").map(([r,a])=>[r,a.toString()]));return new URLSearchParams(t).toString()}function B(){return{url:"https://explorer-api.walletconnect.com",projectId:N.state.projectId}}async function f(e){const{url:t,projectId:r}=B(),a=`${t}/v3/wallets?projectId=${r}&${T(e)}`;return(await fetch(a)).json()}const s=u({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},previewWallets:[],recomendedWallets:[]}),pe={state:s,subscribe(e){return p(s,()=>e(s))},async getPreviewWallets(e){const{listings:t}=await f(e);return s.previewWallets=Object.values(t),s.previewWallets},async getRecomendedWallets(){const{listings:e}=await f({page:1,entries:6});s.recomendedWallets=Object.values(e)},async getPaginatedWallets(e){const{page:t,search:r}=e,{listings:a,total:h}=await f(e),b=Object.values(a),g=r?"search":"wallets";return s[g]={listings:[...s[g].listings,...b],total:h,page:t??1},{listings:b,total:h}},resetSearch(){s.search={listings:[],total:0,page:1}}},o=u({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),v={state:o,subscribe(e){return p(o,()=>e(o))},push(e,t){e!==o.view&&(o.view=e,t&&(o.data=t),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=u({open:!1}),de={state:m,subscribe(e){return p(m,()=>e(m))},open(e){var t;const{chains:r}=l.state;r!=null&&r.length&&r.length>1?v.replace("SelectNetwork"):v.replace("ConnectWallet"),typeof e?.uri=="string"&&l.setStandaloneUri(e.uri),(t=e?.standaloneChains)!=null&&t.length&&l.setStandaloneChains(e.standaloneChains),m.open=!0},close(){m.open=!1}},i=u({open:!1,message:"",variant:"success"}),we={state:i,subscribe(e){return p(i,()=>e(i))},openToast(e,t){i.open=!0,i.message=e,i.variant=t},closeToast(){i.open=!1}},me={watch(e){return n.ethereum().watchAccount(t=>{e(t),t.isDisconnected&&l.setSelectedChainId(void 0)})},get(){return n.ethereum().getAccount()},disconnect(){n.ethereum().disconnect()}};var A=Object.defineProperty,D=Object.defineProperties,L=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,C=(e,t,r)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,R=(e,t)=>{for(var r in t||(t={}))U.call(t,r)&&C(e,r,t[r]);if(y)for(var r of y(t))M.call(t,r)&&C(e,r,t[r]);return e},x=(e,t)=>D(e,L(t));const _={watch(e,t){return n.ethereum().watchBlockNumber(x(R({},t),{listen:!0}),async()=>{const r=await _.fetch(t);e(r)})},async fetch(e){return await n.ethereum().fetchBalance(e)}};var F=Object.defineProperty,H=Object.defineProperties,z=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable,j=(e,t,r)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,J=(e,t)=>{for(var r in t||(t={}))K.call(t,r)&&j(e,r,t[r]);if(O)for(var r of O(t))q.call(t,r)&&j(e,r,t[r]);return e},G=(e,t)=>H(e,z(t));const fe={watch(e,t){return n.ethereum().watchBlockNumber(G(J({},t),{listen:!0}),e)},async fetch(e){return await n.ethereum().fetchBlockNumber(e)}};var Q=Object.defineProperty,V=Object.defineProperties,X=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable,E=(e,t,r)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ee=(e,t)=>{for(var r in t||(t={}))Y.call(t,r)&&E(e,r,t[r]);if(P)for(var r of P(t))Z.call(t,r)&&E(e,r,t[r]);return e},te=(e,t)=>V(e,X(t));const be={get(e){return n.ethereum().getContract(e)},async read(e){return await n.ethereum().readContract(e)},async write(e){const t=await n.ethereum().prepareWriteContract(e);return await n.ethereum().writeContract(t)},watchRead(e,t){return n.ethereum().watchReadContract(te(ee({},t),{listenToBlock:!0}),e)},watchEvent(e,t){return n.ethereum().watchContractEvent(t,e)}},ge={async fetchEnsAddress(e){return await n.ethereum().fetchEnsAddress(e)},async fetchEnsAvatar(e){return await n.ethereum().fetchEnsAvatar(e)},async fetchEnsName(e){return await n.ethereum().fetchEnsName(e)},async fetchEnsResolver(e){return await n.ethereum().fetchEnsResolver(e)}};var re=Object.defineProperty,ne=Object.defineProperties,ae=Object.getOwnPropertyDescriptors,$=Object.getOwnPropertySymbols,oe=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable,S=(e,t,r)=>t in e?re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ce=(e,t)=>{for(var r in t||(t={}))oe.call(t,r)&&S(e,r,t[r]);if($)for(var r of $(t))se.call(t,r)&&S(e,r,t[r]);return e},ie=(e,t)=>ne(e,ae(t));const le={watch(e,t){return n.ethereum().watchBlockNumber(ie(ce({},t),{listen:!0}),async()=>{const r=await le.fetch(t);e(r)})},async fetch(e){return await n.ethereum().fetchFeeData(e)}},ve={watch(e){return n.ethereum().watchNetwork(t=>{var r;l.setSelectedChainId((r=t.chain)==null?void 0:r.id),e(t)})},get(){return n.ethereum().getNetwork()},async switchNetwork(e){return await n.ethereum().switchNetwork(e)}},ye={watch(e,t){return n.ethereum().watchProvider(t,e)},get(e){return n.ethereum().getProvider(e)}},Ce={watch(e,t){return n.ethereum().watchSigner(t,e)},async fetch(e){return await n.ethereum().fetchSigner(e)},async signMessage(e){return await n.ethereum().signMessage(e)},async signTypedData(e){return await n.ethereum().signTypedData(e)}},Oe={async fetch(e){return await n.ethereum().fetchToken(e)}},je={async fetch(e){return await n.ethereum().fetchTransaction(e)},async send(e){const t=await n.ethereum().prepareSendTransaction(e);return await n.ethereum().sendTransaction(t)},async wait(e){return await n.ethereum().waitForTransaction(e)}},Pe={watch(e,t){return n.ethereum().watchWebSocketProvider(t,e)},get(e){return n.ethereum().getWebSocketProvider(e)}},k="WALLETCONNECT_DEEPLINK_CHOICE",Ee={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,r){const a=e.replaceAll("/","").replaceAll(":","");this.setWalletConnectDeepLink(a,r);const h=encodeURIComponent(t);return`${a}://wc?uri=${h}`},formatUniversalUrl(e,t,r){let a=e;e.endsWith("/")&&(a=e.slice(0,-1)),this.setWalletConnectDeepLink(a,r);const h=encodeURIComponent(t);return`${a}/wc?uri=${h}`},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(k,JSON.stringify({href:e,name:t}))},removeWalletConnectDeepLink(){localStorage.removeItem(k)},isNull(e){return e===null}};typeof window<"u"&&(window.Buffer||(window.Buffer=W),window.global||(window.global=window),window.process||(window.process={env:{}}));export{me as AccountCtrl,_ as BalanceCtrl,fe as BlockCtrl,n as ClientCtrl,N as ConfigCtrl,be as ContractCtrl,Ee as CoreHelpers,ge as EnsCtrl,pe as ExplorerCtrl,le as FeeCtrl,de as ModalCtrl,ve as NetworkCtrl,l as OptionsCtrl,ye as ProviderCtrl,v as RouterCtrl,Ce as SignerCtrl,we as ToastCtrl,Oe as TokenCtrl,je as TransactionCtrl,Pe as WebSocketProviderCtrl,B as getExplorerApi}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@web3modal/core", | ||
"version": "2.0.0-6ce38ab", | ||
"version": "2.0.0-a38e60a", | ||
"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", | ||
@@ -22,15 +21,7 @@ "typecheck": "tsc --noEmit" | ||
"buffer": "6.0.3", | ||
"valtio": "1.7.0" | ||
"valtio": "1.7.5" | ||
}, | ||
"devDependencies": { | ||
"@web3modal/ethereum": "2.0.0-6ce38ab" | ||
"@web3modal/ethereum": "2.0.0-a38e60a" | ||
}, | ||
"peerDependencies": { | ||
"@web3modal/ethereum": "*" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@web3modal/ethereum": { | ||
"optional": true | ||
} | ||
}, | ||
"keywords": [ | ||
@@ -45,3 +36,3 @@ "web3", | ||
"author": "WalletConnect <walletconnect.com>", | ||
"license": "MIT", | ||
"license": "Apache-2.0", | ||
"homepage": "https://github.com/web3modal/web3modal", | ||
@@ -48,0 +39,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
2
29
63608
425
+ Addedvaltio@1.7.5(transitive)
- Removed@adraffy/ens-normalize@1.11.0(transitive)
- Removed@noble/curves@1.7.0(transitive)
- Removed@noble/hashes@1.6.01.6.1(transitive)
- Removed@scure/base@1.2.1(transitive)
- Removed@scure/bip32@1.6.0(transitive)
- Removed@scure/bip39@1.5.0(transitive)
- Removed@wagmi/core@2.16.3(transitive)
- Removed@web3modal/ethereum@2.7.1(transitive)
- Removedabitype@1.0.7(transitive)
- Removedeventemitter3@5.0.1(transitive)
- Removedisows@1.0.6(transitive)
- Removedmipd@0.0.7(transitive)
- Removedox@0.6.0(transitive)
- Removedvaltio@1.7.0(transitive)
- Removedviem@2.22.7(transitive)
- Removedwebauthn-p256@0.0.10(transitive)
- Removedws@8.18.0(transitive)
- Removedzustand@5.0.0(transitive)
Updatedvaltio@1.7.5