@nexus-cross/connect-kit-wagmi 1.3.7 → 1.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{a as c,b as l,c as u,d as f}from"./chunk-33PCSJXD.js";import{WALLET_LABELS as p}from"@nexus-cross/crossx-design-system";var r=[{id:"cross_embedded",name:p.default,type:"embedded",iconUrl:c},{id:"cross_extension",name:p.extension,type:"extension",iconUrl:l,rdns:"nexus.to.crosswallet.desktop",installUrl:"https://chromewebstore.google.com/detail/crossx/nninbdadmocnokibpaaohnoepbnpdgcg"},{id:"metamask",name:"MetaMask",type:"external",iconUrl:u,rdns:"io.metamask",installUrl:"https://metamask.io/download/"},{id:"binance",name:"Binance Wallet",type:"external",iconUrl:f,rdns:"com.binance.wallet"}];async function E(e){try{let o=(await import("@to-nexus/appkit-core")).ConnectorController?.state?.connectors;return o?o.some(s=>(s.type==="ANNOUNCED"||s.type==="INJECTED")&&s.info?.rdns===e):void 0}catch{return}}var d,i=!1;function C(e){i||(i=!0,E(e).then(n=>{i=!1,n!==void 0&&(d=n)}))}var t=[],m=!1;function a(){m||typeof window>"u"||(m=!0,window.addEventListener("eip6963:announceProvider",(e=>{e.detail?.info&&(t.some(o=>o.info.rdns===e.detail.info.rdns)||t.push(e.detail))})),window.dispatchEvent(new Event("eip6963:requestProvider")))}function w(e){return a(),t.some(n=>n.info.rdns===e)}function b(e){return t.find(o=>o.info.rdns===e)?.info.icon}function g(){if(d===!0||w("nexus.to.crosswallet.desktop"))return!0;if(typeof window>"u")return!1;let e=window;if(e.cross||e.crossWallet)return!0;let n=e.ethereum;return n?!!(n.isCross||n.providers?.some(o=>o.isCross)):!1}function x(){if(typeof window>"u")return!1;let e=window.ethereum;return e?e.providers?.length?e.providers.some(n=>n.isMetaMask&&!n.isCross&&!n.isBinance):!!e.isMetaMask&&!e.isCross&&!e.isBinance:!1}function k(e=r){return a(),C("nexus.to.crosswallet.desktop"),e.map(n=>{let o=!1,s=n.rdns?b(n.rdns):void 0;return n.rdns&&w(n.rdns)?o=!0:n.id==="cross_extension"?o=g():n.id==="metamask"?o=x():n.id==="cross_embedded"&&(o=!0),{...n,installed:o,iconUrl:s||n.iconUrl}})}function y(){if(typeof window>"u")return;a();let e=window;console.group("[crossx-kit] debugDetect"),console.log("EIP-6963 announced:",t.map(n=>n.info)),console.log("window.crossWallet:",typeof e.crossWallet),console.log("window.cross:",typeof e.cross),console.log("window.ethereum:",{exists:!!e.ethereum,isMetaMask:e.ethereum?.isMetaMask,isCross:e.ethereum?.isCross,isBinance:e.ethereum?.isBinance,providers:e.ethereum?.providers?.map(n=>({isMetaMask:n.isMetaMask,isCross:n.isCross,isBinance:n.isBinance}))}),console.log("CROSSx SDK probe (ConnectorController.connectors):",d),console.log("Detected wallets:",k(r)),console.groupEnd()}typeof window<"u"&&(window.__crossxKit_debugDetect=y);export{r as a,w as b,k as c,y as d};
1
+ import{a as c,b as l,c as u,d as f}from"./chunk-TNPVFJYC.js";import{WALLET_LABELS as p}from"@nexus-cross/crossx-design-system";var r=[{id:"cross_embedded",name:p.default,type:"embedded",iconUrl:c},{id:"cross_extension",name:p.extension,type:"extension",iconUrl:l,rdns:"nexus.to.crosswallet.desktop",installUrl:"https://chromewebstore.google.com/detail/crossx/nninbdadmocnokibpaaohnoepbnpdgcg"},{id:"metamask",name:"MetaMask",type:"external",iconUrl:u,rdns:"io.metamask",installUrl:"https://metamask.io/download/"},{id:"binance",name:"Binance Wallet",type:"external",iconUrl:f,rdns:"com.binance.wallet"}];async function E(e){try{let o=(await import("@to-nexus/appkit-core")).ConnectorController?.state?.connectors;return o?o.some(s=>(s.type==="ANNOUNCED"||s.type==="INJECTED")&&s.info?.rdns===e):void 0}catch{return}}var d,i=!1;function C(e){i||(i=!0,E(e).then(n=>{i=!1,n!==void 0&&(d=n)}))}var t=[],m=!1;function a(){m||typeof window>"u"||(m=!0,window.addEventListener("eip6963:announceProvider",(e=>{e.detail?.info&&(t.some(o=>o.info.rdns===e.detail.info.rdns)||t.push(e.detail))})),window.dispatchEvent(new Event("eip6963:requestProvider")))}function w(e){return a(),t.some(n=>n.info.rdns===e)}function b(e){return t.find(o=>o.info.rdns===e)?.info.icon}function g(){if(d===!0||w("nexus.to.crosswallet.desktop"))return!0;if(typeof window>"u")return!1;let e=window;if(e.cross||e.crossWallet)return!0;let n=e.ethereum;return n?!!(n.isCross||n.providers?.some(o=>o.isCross)):!1}function x(){if(typeof window>"u")return!1;let e=window.ethereum;return e?e.providers?.length?e.providers.some(n=>n.isMetaMask&&!n.isCross&&!n.isBinance):!!e.isMetaMask&&!e.isCross&&!e.isBinance:!1}function k(e=r){return a(),C("nexus.to.crosswallet.desktop"),e.map(n=>{let o=!1,s=n.rdns?b(n.rdns):void 0;return n.rdns&&w(n.rdns)?o=!0:n.id==="cross_extension"?o=g():n.id==="metamask"?o=x():n.id==="cross_embedded"&&(o=!0),{...n,installed:o,iconUrl:s||n.iconUrl}})}function y(){if(typeof window>"u")return;a();let e=window;console.group("[crossx-kit] debugDetect"),console.log("EIP-6963 announced:",t.map(n=>n.info)),console.log("window.crossWallet:",typeof e.crossWallet),console.log("window.cross:",typeof e.cross),console.log("window.ethereum:",{exists:!!e.ethereum,isMetaMask:e.ethereum?.isMetaMask,isCross:e.ethereum?.isCross,isBinance:e.ethereum?.isBinance,providers:e.ethereum?.providers?.map(n=>({isMetaMask:n.isMetaMask,isCross:n.isCross,isBinance:n.isBinance}))}),console.log("CROSSx SDK probe (ConnectorController.connectors):",d),console.log("Detected wallets:",k(r)),console.groupEnd()}typeof window<"u"&&(window.__crossxKit_debugDetect=y);export{r as a,w as b,k as c,y as d};
@@ -1 +1 @@
1
- import{a as t,b as o,c as r,d as a}from"./chunk-33PCSJXD.js";import{walletConnect as l}from"wagmi/connectors";import{WALLET_LABELS as c}from"@nexus-cross/crossx-design-system";function C(e=c.default,n="walletConnect"){return{walletId:"cross_wallet",providerKind:"cross",type:"app",connectorId:n,name:e,iconUrl:t}}function m(){return{walletId:"cross_extension",providerKind:"cross",type:"extension",connectorId:"nexus.to.crosswallet.desktop",name:c.extension,iconUrl:o,installUrl:"https://chromewebstore.google.com/detail/crossx/nninbdadmocnokibpaaohnoepbnpdgcg"}}function p(e,n="walletConnect"){return{walletId:"metamask",providerKind:e,type:"external",connectorId:"io.metamask",aliasConnectorIds:["injected","metaMaskSDK"],name:"MetaMask",iconUrl:r,installUrl:"https://metamask.io/download/",fallbackConnectorId:n}}function u(e,n="walletConnect"){return{walletId:"binance",providerKind:e,type:"external",connectorId:"com.binance.wallet",aliasConnectorIds:["walletConnect"],name:"Binance Wallet",iconUrl:a,fallbackConnectorId:n}}export{C as a,m as b,p as c,u as d};
1
+ import{a as t,b as o,c as r,d as a}from"./chunk-TNPVFJYC.js";import{walletConnect as l}from"wagmi/connectors";import{WALLET_LABELS as c}from"@nexus-cross/crossx-design-system";function C(e=c.default,n="walletConnect"){return{walletId:"cross_wallet",providerKind:"cross",type:"app",connectorId:n,name:e,iconUrl:t}}function m(){return{walletId:"cross_extension",providerKind:"cross",type:"extension",connectorId:"nexus.to.crosswallet.desktop",name:c.extension,iconUrl:o,installUrl:"https://chromewebstore.google.com/detail/crossx/nninbdadmocnokibpaaohnoepbnpdgcg"}}function p(e,n="walletConnect"){return{walletId:"metamask",providerKind:e,type:"external",connectorId:"io.metamask",aliasConnectorIds:["injected","metaMaskSDK"],name:"MetaMask",iconUrl:r,installUrl:"https://metamask.io/download/",fallbackConnectorId:n}}function u(e,n="walletConnect"){return{walletId:"binance",providerKind:e,type:"external",connectorId:"com.binance.wallet",aliasConnectorIds:["walletConnect"],name:"Binance Wallet",iconUrl:a,fallbackConnectorId:n}}export{C as a,m as b,p as c,u as d};
@@ -0,0 +1 @@
1
+ var i='<svg preserveAspectRatio="xMidYMid meet" width="100%" height="100%" style="display: block;" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_72837_24069)"><mask id="mask0_72837_24069" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="100" height="100"><path d="M50 0C10.5289 0 0 10.5289 0 50C0 89.4711 10.5289 100 50 100C89.4711 100 100 89.4711 100 50C100 10.5289 89.4711 0 50 0Z" fill="white"/></mask><g mask="url(#mask0_72837_24069)"><path d="M99.9501 0.0499268H0V100H99.9501V0.0499268Z" fill="url(#paint0_linear_72837_24069)"/><path d="M34.9302 100H99.9751V19.0619L34.9302 60.7286V100Z" fill="url(#paint1_linear_72837_24069)"/><path d="M34.9301 100H0V23.8024L34.9301 60.7285V100Z" fill="url(#paint2_linear_72837_24069)"/></g><g filter="url(#filter0_d_72837_24069)"><path d="M49.9503 21.4821L31.9862 31.8613C28.8176 33.6827 27.7198 37.7745 29.5411 40.9432C31.3625 44.1118 35.4543 45.2096 38.623 43.3883L53.8176 34.6058L46.582 42.3653V72.8044C46.582 76.4721 49.576 79.4661 53.2437 79.4661C56.9114 79.4661 59.9054 76.4721 59.9054 72.8044V27.2455C59.9054 25.9731 59.5062 24.7256 59.0072 23.9022C57.1359 20.7585 53.094 19.6358 49.9254 21.4571L49.9503 21.4821Z" fill="white"/></g></g><defs><filter id="filter0_d_72837_24069" x="7.4286" y="-0.650014" width="87.831" height="115.47" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dx="7.06088" dy="7.06088"/><feGaussianBlur stdDeviation="14.1467"/><feColorMatrix type="matrix" values="0 0 0 0 0.831373 0 0 0 0 0.113725 0 0 0 0 0.356863 0 0 0 0.3 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_72837_24069"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_72837_24069" result="shape"/></filter><linearGradient id="paint0_linear_72837_24069" x1="-11.5768" y1="-12.001" x2="106.562" y2="106.986" gradientUnits="userSpaceOnUse"><stop stop-color="#F3752D"/><stop offset="1" stop-color="#EC1272"/></linearGradient><linearGradient id="paint1_linear_72837_24069" x1="24.9501" y1="23.004" x2="73.6278" y2="64.8453" gradientUnits="userSpaceOnUse"><stop stop-color="white" stop-opacity="0.5"/><stop offset="1" stop-color="white" stop-opacity="0"/></linearGradient><linearGradient id="paint2_linear_72837_24069" x1="62.3503" y1="3.46804" x2="16.3423" y2="63.3732" gradientUnits="userSpaceOnUse"><stop stop-color="white" stop-opacity="0.5"/><stop offset="1" stop-color="white" stop-opacity="0"/></linearGradient><clipPath id="clip0_72837_24069"><rect width="100" height="100" fill="white"/></clipPath></defs></svg>',e='<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 28 28" fill="none"><g clip-path="url(#m0)"><path d="M26.07 26.93L20.06 25.07L15.53 27.88L12.37 27.88L7.83 25.07L1.83 26.93L0 20.53L1.83 13.44L0 7.44L1.83 0L11.21 5.81H16.69L26.07 0L27.9 7.44L26.07 13.44L27.9 20.53Z" fill="#FF5C16"/><path d="M7.83 20.54L11.96 23.8L7.83 25.07V20.54Z" fill="#FF5C16"/><path d="M20.06 20.54L15.93 23.8L20.06 25.07L20.06 20.54Z" fill="#FF5C16"/><path d="M11.63 15.14L12.78 22.85L11.19 18.56L5.77 17.17L7.83 15.14H11.63Z" fill="#E34807"/><path d="M16.27 15.14L15.12 22.85L16.71 18.56L22.13 17.17L20.07 15.14H16.27Z" fill="#E34807"/><path d="M0 20.53L1.83 13.44H5.76L5.77 17.17L11.19 18.56L12.78 22.85L11.96 23.79L7.83 20.53H0Z" fill="#FF8D5D"/><path d="M27.9 20.53L26.07 13.44H22.14L22.13 17.17L16.71 18.56L15.12 22.85L15.94 23.79L20.07 20.53H27.9Z" fill="#FF8D5D"/><path d="M16.69 5.81H11.21L10.84 9.81L12.78 22.85H15.12L17.06 9.81L16.69 5.81Z" fill="#FF8D5D"/><path d="M15.53 25.34V27.88H12.37V25.34H15.53Z" fill="#C0C4CD"/><path d="M7.83 25.07L12.37 27.88V25.34L11.96 23.79L7.83 25.07Z" fill="#E7EBF6"/><path d="M20.07 25.07L15.53 27.88V25.34L15.94 23.79L20.07 25.07Z" fill="#E7EBF6"/></g><defs><clipPath id="m0"><rect width="28" height="28" fill="#fff"/></clipPath></defs></svg>',a='<svg width="100%" height="100%" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z" fill="#F3BA2F"/><path d="M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z" fill="#F3BA2F"/><path d="M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z" fill="#F3BA2F"/><path d="M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z" fill="#F3BA2F"/><path d="M24.58 20L20 15.41L16.61 18.8L16.22 19.19L15.42 19.99L20 24.59L24.59 20L24.58 20Z" fill="#F3BA2F"/></svg>',L='<svg width="100%" height="100%" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="40" height="40" rx="8" fill="#3B99FC" fill-opacity="0.1"/><path d="M14.5 17C17.5 14 22.5 14 25.5 17L25.9 17.4C26.1 17.6 26.1 17.9 25.9 18.1L24.7 19.3C24.6 19.4 24.4 19.4 24.3 19.3L23.8 18.8C21.7 16.7 18.3 16.7 16.2 18.8L15.6 19.4C15.5 19.5 15.3 19.5 15.2 19.4L14 18.2C13.8 18 13.8 17.7 14 17.5L14.5 17Z" fill="#3B99FC"/><path d="M28 19.5L29 20.5C29.2 20.7 29.2 21 29 21.2L23.5 26.7C23.3 26.9 23 26.9 22.8 26.7L19.2 23.1C19.15 23.05 19.05 23.05 19 23.1L15.4 26.7C15.2 26.9 14.9 26.9 14.7 26.7L9.2 21.2C9 21 9 20.7 9.2 20.5L10.2 19.5C10.4 19.3 10.7 19.3 10.9 19.5L14.5 23.1C14.55 23.15 14.65 23.15 14.7 23.1L18.3 19.5C18.5 19.3 18.8 19.3 19 19.5L22.6 23.1C22.65 23.15 22.75 23.15 22.8 23.1L26.4 19.5C26.6 19.3 26.9 19.3 27.1 19.5L28 19.5Z" fill="#3B99FC"/></svg>',o='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><path fill="#FFC107" d="M43.6 20.5H42V20H24v8h11.3A12 12 0 1 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 1 0 44 24c0-1.2-.1-2.4-.4-3.5z"/><path fill="#FF3D00" d="M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z"/><path fill="#4CAF50" d="M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28l-6.5 5A20 20 0 0 0 24 44z"/><path fill="#1976D2" d="M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4.1 5.5l6.3 5.3C41 35.7 44 30.3 44 24c0-1.2-.1-2.4-.4-3.5z"/></svg>',s='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.53 4.08zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"/></svg>';function t(l){return`data:image/svg+xml,${encodeURIComponent(l)}`}var p=t(i),r=t(i),n=t(e),h=t(a),d=t(L),f=t(o),c=t(s);export{p as a,r as b,n as c,h as d,d as e,f,c as g};
package/dist/index.d.ts CHANGED
@@ -237,8 +237,8 @@ declare function debugDetect(): void;
237
237
  * self-contained, bundler-agnostic module (no SVG loader required).
238
238
  *
239
239
  * Source references (read-only, posa repo):
240
- * wallet-crossx.svg → CROSSX_ICON (cross_wallet, cross_embedded)
241
- * wallet-crossx.svg → EXTENSION_ICON (cross_extension — shares art)
240
+ * ONEwallet brand mark → CROSSX_ICON (cross_wallet, cross_embedded) — pink→orange gradient
241
+ * ONEwallet brand mark → EXTENSION_ICON (cross_extension — shares art)
242
242
  * wallet-metamask.svg → METAMASK_ICON
243
243
  * wallet-binance.svg → BINANCE_ICON
244
244
  * wallet-walletconnect.svg → WALLETCONNECT_ICON (generic WC fallback)
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as X,b as $}from"./chunk-6BKDRLN2.js";import{a as te,c as oe,d as re}from"./chunk-GTPQJJND.js";import{a as g,b as Q,c as V,d as z,e as J,f as Z,g as ee}from"./chunk-33PCSJXD.js";import{defaultDesignSystem as le,toSdkColorOverrides as L,WALLET_LABELS as Ce}from"@nexus-cross/crossx-design-system";var w=new Set;function ne(e){return w.add(e),()=>{w.delete(e)}}function T(){w.forEach(e=>e())}function x(e){let o=new Map,r=new Map;for(let t of e){o.set(t.walletId,t);let n=[t.connectorId,...t.aliasConnectorIds??[]];for(let i of n){let d=r.get(i);d?d.push(t):r.set(i,[t])}}return{entries:e,getEntry:t=>o.get(t),getEntriesByConnectorId:t=>r.get(t)??[],getEntryByConnectorId:t=>r.get(t)?.[0],toWalletDescriptors:()=>e.map(t=>({id:t.walletId,name:t.name,type:t.type,iconUrl:t.iconUrl,installUrl:t.installUrl}))}}function se(e,o,r){if(!o)return null;let t=e.getEntriesByConnectorId(o);if(t.length===0)return null;if(t.length===1)return t[0].walletId;if(r){let n=t.find(i=>i.walletId===r);if(n)return n.walletId}return t[0].walletId}import{connect as ie}from"@wagmi/core";var O="crossx";function ce(e){return typeof e=="object"&&e!==null&&e.code==="ALREADY_AUTHENTICATED"}function I(e){async function o(){let r=e.connectors.find(t=>t.id===O);if(r)try{await ie(e,{connector:r})}catch{}}return{async signIn(r){let t=e.connectors.find(c=>c.id===O);if(!t)throw new Error("[crossx-kit] cross_embedded connector not configured. Pass `embeddedConnectorFactory` to createCrossxConfig.");if(typeof t.getProvider!="function")throw new Error("[crossx-kit] cross_embedded connector does not expose getProvider().");let i=(await t.getProvider())?.sdk,d=i?.signInWithCreate??i?.signIn;if(!i||typeof d!="function")throw new Error("[crossx-kit] crossy-sdk signIn/signInWithCreate is unavailable.");let l;try{l=await d.call(i,{provider:r})}catch(c){if(ce(c)){await o();return}throw c}if(l&&l.success===!1)throw new Error(`[crossx-kit] OAuth sign-in did not complete: ${l.error??"unknown reason"}`);await o()}}}import{CHAIN_DISPLAY as _,NATIVE_SYMBOL as p}from"@nexus-cross/crossx-design-system";var E=612055,S=612044,b=56,W=97,ae={id:E,name:_.mainnet,nativeCurrency:{name:p.mainnet,symbol:p.mainnet,decimals:18},rpcUrl:"https://mainnet.crosstoken.io:22001",blockExplorerUrl:"https://www.crossscan.io",testnet:!1},de={id:S,name:_.testnet,nativeCurrency:{name:p.testnet,symbol:p.testnet,decimals:18},rpcUrl:"https://testnet.crosstoken.io:22001",blockExplorerUrl:"https://testnet.crossscan.io",testnet:!0},R={id:b,name:"BSC Mainnet",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrl:"https://bsc-mainnet.crosstoken.io/2272489872e4f1475ff25d57ce93b51989f933c7",blockExplorerUrl:"https://bscscan.com",testnet:!1},K={id:W,name:"BSC Testnet",nativeCurrency:{name:"tBNB",symbol:"tBNB",decimals:18},rpcUrl:"https://bsc-testnet.crosstoken.io/110ea3628b77f244e5dbab16790d81bba874b962",blockExplorerUrl:"https://testnet.bscscan.com",testnet:!0},B={[E]:R,[S]:K};function h(e){let o=new Set(e.map(t=>t.id)),r=[];for(let t of e){let n=B[t.id];n&&!o.has(n.id)&&(r.push(n),o.add(n.id))}return r.length===0?e:[...e,...r]}function D(e){let o=new Set(e.map(t=>t.id)),r=[];for(let t of e){let n=B[t.id];n&&!o.has(n.id)&&(r.push(n),o.add(n.id))}return r}var fe="crossx-kit:active-provider";function pe(e){let{crossProvider:o,reownProvider:r,embeddedConnectorFactory:t,walletGuides:n,defaultProvider:i,disableBscAutoRegister:d,designSystem:l=le,...c}=e;if(!o&&!r)throw new Error("[crossx-kit] createCrossxConfig requires at least one of `crossProvider` (from @nexus-cross/connect-kit-wagmi/to-nexus) or `reownProvider` (from @nexus-cross/connect-kit-wagmi/reown).");let U={light:L(l,"light"),dark:L(l,"dark")},m=d?c:{...c,networks:h(c.networks)},f={...m,themeTokens:m.themeTokens??U,restoreChainAfterSwitch:m.restoreChainAfterSwitch??!0};if(!d){let s=D(c.networks);s.length>0&&console.info("[crossx-kit] auto-registered BSC network(s) for CROSS token sends: "+s.map(a=>`${a.name}(${a.id})`).join(", ")+". Pass `disableBscAutoRegister: true` to opt out.")}let C=null,y=[];if(o){let s=[],a=t?t(f,T):null;a&&s.push({connector:a,registryEntry:{walletId:"cross_embedded",providerKind:"cross",type:"embedded",connectorId:"crossx",name:Ce.default,iconUrl:g}});let P=o.buildWagmiConfig({kitConfig:f,extraConnectors:s});C=P.wagmiConfig,y.push(...P.registryEntries)}let A=null,v=[];if(r){let s=r.buildWagmiConfig({kitConfig:f,extraConnectors:[]});A=s.wagmiConfig,v.push(...s.registryEntries)}let N=[...y,...v],F=n?N.map(s=>{let a=n[s.walletId];return a?{...s,guideUrl:a.url,guideLabel:a.label}:s}):N,q=x(F),H=i??(C?"cross":"reown"),G=y.some(s=>s.walletId==="cross_embedded"),Y=C&&G?I(C):null;return{kitConfig:f,crossWagmiConfig:C,reownWagmiConfig:A,connectorRegistry:q,crossProvider:o??null,reownProvider:r??null,defaultProvider:H,activeProviderStorageKey:fe,oauth:Y,designSystem:l}}var M=["wc@","@w3m","@walletconnect","@appkit","wagmi"];function ue(e=M){if(typeof window>"u")return;let o=(()=>{try{return window.localStorage}catch{return null}})();if(o)try{let r=[];for(let t=0;t<o.length;t+=1){let n=o.key(t);n&&e.some(i=>n.startsWith(i))&&r.push(n)}for(let t of r)o.removeItem(t)}catch{}}import{cookieToInitialState as j}from"wagmi";function me(e,o){if(!o)return;let r={cross:e.crossWagmiConfig?j(e.crossWagmiConfig,o):void 0,reown:e.reownWagmiConfig?j(e.reownWagmiConfig,o):void 0};return r.cross||r.reown?r:void 0}function ye(e,o){if(e)return o==="cross"?e.cross:e.reown}import{injected as ge}from"wagmi/connectors";import{WALLET_LABELS as k}from"@nexus-cross/crossx-design-system";function u(){if(typeof window>"u")return;let e=window.crossWallet??window.cross;if(!e?.request)return;let o=e.request.bind(e);return new Proxy(e,{get(r,t){return t==="request"?async n=>n.method==="wallet_requestPermissions"?[]:o(n):r[t]}})}function we(){return ge({target(){let e=u();return e?{id:"nexus.to.crosswallet.desktop",name:k.extension,provider:e}:{id:"nexus.to.crosswallet.desktop",name:k.extension,provider:{request:async o=>{let r=u();if(!r)throw new Error(`${k.extension} is not installed. Please install it and refresh.`);return r.request(o)},on:(...o)=>{u()?.on?.(...o)},removeListener:(...o)=>{u()?.removeListener?.(...o)}}}}})}import{walletConnect as xe}from"wagmi/connectors";function Ie(e){return xe({projectId:e.projectId,metadata:e.metadata?{name:e.metadata.name,description:e.metadata.description??"",url:e.metadata.url,icons:e.metadata.icons??[]}:void 0,showQrModal:e.showQrModal??!1})}export{ee as APPLE_ICON,z as BINANCE_ICON,b as BSC_MAINNET_CHAIN_ID,W as BSC_TESTNET_CHAIN_ID,g as CROSSX_ICON,E as CROSS_MAINNET_CHAIN_ID,S as CROSS_TESTNET_CHAIN_ID,M as DEFAULT_SESSION_STORAGE_PREFIXES,te as DEFAULT_WALLET_REGISTRY,Q as EXTENSION_ICON,Z as GOOGLE_ICON,V as METAMASK_ICON,J as WALLETCONNECT_ICON,R as bscMainnetNetwork,K as bscTestnetNetwork,ue as clearWalletSessionStorage,me as cookieToCrossConnectKitState,x as createConnectorRegistry,pe as createCrossxConfig,I as createCrossySdkOAuthAdapter,Ie as createWalletConnectConnector,we as crossExtensionConnector,ae as crossMainnetNetwork,de as crossTestnetNetwork,re as debugDetect,$ as deriveSDKThemeTokensFromWalletInfo,oe as detectWallets,ne as onOpenOtherWallets,ye as pickInitialState,X as readWalletInfoTokens,se as resolveCurrentWallet,h as withRequiredBscPairs};
1
+ import{a as X,b as $}from"./chunk-6BKDRLN2.js";import{a as te,c as oe,d as re}from"./chunk-FGGO4LLZ.js";import{a as g,b as Q,c as V,d as z,e as J,f as Z,g as ee}from"./chunk-TNPVFJYC.js";import{defaultDesignSystem as le,toSdkColorOverrides as L,WALLET_LABELS as Ce}from"@nexus-cross/crossx-design-system";var w=new Set;function ne(e){return w.add(e),()=>{w.delete(e)}}function T(){w.forEach(e=>e())}function x(e){let o=new Map,r=new Map;for(let t of e){o.set(t.walletId,t);let n=[t.connectorId,...t.aliasConnectorIds??[]];for(let i of n){let d=r.get(i);d?d.push(t):r.set(i,[t])}}return{entries:e,getEntry:t=>o.get(t),getEntriesByConnectorId:t=>r.get(t)??[],getEntryByConnectorId:t=>r.get(t)?.[0],toWalletDescriptors:()=>e.map(t=>({id:t.walletId,name:t.name,type:t.type,iconUrl:t.iconUrl,installUrl:t.installUrl}))}}function se(e,o,r){if(!o)return null;let t=e.getEntriesByConnectorId(o);if(t.length===0)return null;if(t.length===1)return t[0].walletId;if(r){let n=t.find(i=>i.walletId===r);if(n)return n.walletId}return t[0].walletId}import{connect as ie}from"@wagmi/core";var O="crossx";function ce(e){return typeof e=="object"&&e!==null&&e.code==="ALREADY_AUTHENTICATED"}function I(e){async function o(){let r=e.connectors.find(t=>t.id===O);if(r)try{await ie(e,{connector:r})}catch{}}return{async signIn(r){let t=e.connectors.find(c=>c.id===O);if(!t)throw new Error("[crossx-kit] cross_embedded connector not configured. Pass `embeddedConnectorFactory` to createCrossxConfig.");if(typeof t.getProvider!="function")throw new Error("[crossx-kit] cross_embedded connector does not expose getProvider().");let i=(await t.getProvider())?.sdk,d=i?.signInWithCreate??i?.signIn;if(!i||typeof d!="function")throw new Error("[crossx-kit] crossy-sdk signIn/signInWithCreate is unavailable.");let l;try{l=await d.call(i,{provider:r})}catch(c){if(ce(c)){await o();return}throw c}if(l&&l.success===!1)throw new Error(`[crossx-kit] OAuth sign-in did not complete: ${l.error??"unknown reason"}`);await o()}}}import{CHAIN_DISPLAY as _,NATIVE_SYMBOL as p}from"@nexus-cross/crossx-design-system";var E=612055,S=612044,b=56,W=97,ae={id:E,name:_.mainnet,nativeCurrency:{name:p.mainnet,symbol:p.mainnet,decimals:18},rpcUrl:"https://mainnet.crosstoken.io:22001",blockExplorerUrl:"https://www.crossscan.io",testnet:!1},de={id:S,name:_.testnet,nativeCurrency:{name:p.testnet,symbol:p.testnet,decimals:18},rpcUrl:"https://testnet.crosstoken.io:22001",blockExplorerUrl:"https://testnet.crossscan.io",testnet:!0},R={id:b,name:"BSC Mainnet",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrl:"https://bsc-mainnet.crosstoken.io/2272489872e4f1475ff25d57ce93b51989f933c7",blockExplorerUrl:"https://bscscan.com",testnet:!1},K={id:W,name:"BSC Testnet",nativeCurrency:{name:"tBNB",symbol:"tBNB",decimals:18},rpcUrl:"https://bsc-testnet.crosstoken.io/110ea3628b77f244e5dbab16790d81bba874b962",blockExplorerUrl:"https://testnet.bscscan.com",testnet:!0},B={[E]:R,[S]:K};function h(e){let o=new Set(e.map(t=>t.id)),r=[];for(let t of e){let n=B[t.id];n&&!o.has(n.id)&&(r.push(n),o.add(n.id))}return r.length===0?e:[...e,...r]}function D(e){let o=new Set(e.map(t=>t.id)),r=[];for(let t of e){let n=B[t.id];n&&!o.has(n.id)&&(r.push(n),o.add(n.id))}return r}var fe="crossx-kit:active-provider";function pe(e){let{crossProvider:o,reownProvider:r,embeddedConnectorFactory:t,walletGuides:n,defaultProvider:i,disableBscAutoRegister:d,designSystem:l=le,...c}=e;if(!o&&!r)throw new Error("[crossx-kit] createCrossxConfig requires at least one of `crossProvider` (from @nexus-cross/connect-kit-wagmi/to-nexus) or `reownProvider` (from @nexus-cross/connect-kit-wagmi/reown).");let U={light:L(l,"light"),dark:L(l,"dark")},m=d?c:{...c,networks:h(c.networks)},f={...m,themeTokens:m.themeTokens??U,restoreChainAfterSwitch:m.restoreChainAfterSwitch??!0};if(!d){let s=D(c.networks);s.length>0&&console.info("[crossx-kit] auto-registered BSC network(s) for CROSS token sends: "+s.map(a=>`${a.name}(${a.id})`).join(", ")+". Pass `disableBscAutoRegister: true` to opt out.")}let C=null,y=[];if(o){let s=[],a=t?t(f,T):null;a&&s.push({connector:a,registryEntry:{walletId:"cross_embedded",providerKind:"cross",type:"embedded",connectorId:"crossx",name:Ce.default,iconUrl:g}});let P=o.buildWagmiConfig({kitConfig:f,extraConnectors:s});C=P.wagmiConfig,y.push(...P.registryEntries)}let A=null,v=[];if(r){let s=r.buildWagmiConfig({kitConfig:f,extraConnectors:[]});A=s.wagmiConfig,v.push(...s.registryEntries)}let N=[...y,...v],F=n?N.map(s=>{let a=n[s.walletId];return a?{...s,guideUrl:a.url,guideLabel:a.label}:s}):N,q=x(F),H=i??(C?"cross":"reown"),G=y.some(s=>s.walletId==="cross_embedded"),Y=C&&G?I(C):null;return{kitConfig:f,crossWagmiConfig:C,reownWagmiConfig:A,connectorRegistry:q,crossProvider:o??null,reownProvider:r??null,defaultProvider:H,activeProviderStorageKey:fe,oauth:Y,designSystem:l}}var M=["wc@","@w3m","@walletconnect","@appkit","wagmi"];function ue(e=M){if(typeof window>"u")return;let o=(()=>{try{return window.localStorage}catch{return null}})();if(o)try{let r=[];for(let t=0;t<o.length;t+=1){let n=o.key(t);n&&e.some(i=>n.startsWith(i))&&r.push(n)}for(let t of r)o.removeItem(t)}catch{}}import{cookieToInitialState as j}from"wagmi";function me(e,o){if(!o)return;let r={cross:e.crossWagmiConfig?j(e.crossWagmiConfig,o):void 0,reown:e.reownWagmiConfig?j(e.reownWagmiConfig,o):void 0};return r.cross||r.reown?r:void 0}function ye(e,o){if(e)return o==="cross"?e.cross:e.reown}import{injected as ge}from"wagmi/connectors";import{WALLET_LABELS as k}from"@nexus-cross/crossx-design-system";function u(){if(typeof window>"u")return;let e=window.crossWallet??window.cross;if(!e?.request)return;let o=e.request.bind(e);return new Proxy(e,{get(r,t){return t==="request"?async n=>n.method==="wallet_requestPermissions"?[]:o(n):r[t]}})}function we(){return ge({target(){let e=u();return e?{id:"nexus.to.crosswallet.desktop",name:k.extension,provider:e}:{id:"nexus.to.crosswallet.desktop",name:k.extension,provider:{request:async o=>{let r=u();if(!r)throw new Error(`${k.extension} is not installed. Please install it and refresh.`);return r.request(o)},on:(...o)=>{u()?.on?.(...o)},removeListener:(...o)=>{u()?.removeListener?.(...o)}}}}})}import{walletConnect as xe}from"wagmi/connectors";function Ie(e){return xe({projectId:e.projectId,metadata:e.metadata?{name:e.metadata.name,description:e.metadata.description??"",url:e.metadata.url,icons:e.metadata.icons??[]}:void 0,showQrModal:e.showQrModal??!1})}export{ee as APPLE_ICON,z as BINANCE_ICON,b as BSC_MAINNET_CHAIN_ID,W as BSC_TESTNET_CHAIN_ID,g as CROSSX_ICON,E as CROSS_MAINNET_CHAIN_ID,S as CROSS_TESTNET_CHAIN_ID,M as DEFAULT_SESSION_STORAGE_PREFIXES,te as DEFAULT_WALLET_REGISTRY,Q as EXTENSION_ICON,Z as GOOGLE_ICON,V as METAMASK_ICON,J as WALLETCONNECT_ICON,R as bscMainnetNetwork,K as bscTestnetNetwork,ue as clearWalletSessionStorage,me as cookieToCrossConnectKitState,x as createConnectorRegistry,pe as createCrossxConfig,I as createCrossySdkOAuthAdapter,Ie as createWalletConnectConnector,we as crossExtensionConnector,ae as crossMainnetNetwork,de as crossTestnetNetwork,re as debugDetect,$ as deriveSDKThemeTokensFromWalletInfo,oe as detectWallets,ne as onOpenOtherWallets,ye as pickInitialState,X as readWalletInfoTokens,se as resolveCurrentWallet,h as withRequiredBscPairs};
package/dist/reown.js CHANGED
@@ -1 +1 @@
1
- import{b as p}from"./chunk-GTPQJJND.js";import{c as f,d as u}from"./chunk-RT2R34G4.js";import"./chunk-33PCSJXD.js";import{createAppKit as I}from"@reown/appkit";import{WagmiAdapter as E}from"@reown/appkit-adapter-wagmi";import{mainnet as m,sepolia as w,bsc as C,bscTestnet as y,defineChain as R}from"@reown/appkit/networks";import{resolveThemeMode as K}from"@nexus-cross/connect-kit-core";function N(t){return K(t,void 0)}var P=new Map([[m.id,m],[w.id,w],[C.id,C],[y.id,y]]),x="c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",B="8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",b=[x,B],M="eip155",j={binance:"binance",metamask:"metamask"},s=new Map;function v(t){return t.isReady()?Promise.resolve(!0):new Promise(e=>{let o=!1,n=setTimeout(()=>r(!1),2500),r=a=>{o||(o=!0,clearTimeout(n),e(a))};t.subscribeIsReady(({isReady:a})=>{a&&r(!0)})})}function g(t){t.appKit.open({view:"Connect"}).catch(e=>{typeof console<"u"&&console.warn("[crossx-kit] reownAdapter: appKit.open failed",e)})}async function O(t,e){let o=j[e];if(!o)return"defer";try{let{createAppKitWalletButton:n}=await import("@reown/appkit-wallet-button"),r=n({namespace:M});return await v(r)?(r.connect(o).catch(()=>{}),"handled"):(g(t),"handled")}catch{return g(t),"handled"}}function _(t){return R({id:t.id,chainNamespace:"eip155",caipNetworkId:`eip155:${t.id}`,name:t.name,nativeCurrency:t.nativeCurrency,rpcUrls:{default:{http:[t.rpcUrl]}},...t.blockExplorerUrl?{blockExplorers:{default:{name:"Explorer",url:t.blockExplorerUrl}}}:{},...t.testnet===void 0?{}:{testnet:t.testnet}})}function S(t){let e=[],o=!1;for(let n of t){let r=P.get(n.id);r?(e.push(r),o=!0):e.push(_(n))}if(!o)throw new Error(`[crossx-kit] reownAdapter: kitConfig.networks [${t.map(n=>n.id).join(", ")}] must include at least one Reown preset network (Ethereum mainnet/sepolia, BSC mainnet/testnet) so the WalletConnect relay has a recognized chain. CROSS and other custom EVM chains are now registered as custom networks, but cannot stand alone on the reown side \u2014 use toNexusAdapter for CROSS-only flows.`);return e}function T(t){let{kitConfig:e,extraConnectors:o}=t;if(!e.reownProjectId)throw new Error("[crossx-kit] reownAdapter requires CrossConnectKitConfig.reownProjectId \u2014 register a WalletConnect Cloud project at https://cloud.reown.com.");let n=e.reownProjectId,r=s.get(n);if(r)return r;let a=S(e.networks),i=e.defaultNetwork&&a.find(c=>c.id===e.defaultNetwork?.id)||a[0],h=o.map(c=>c.connector),d=new E({projectId:e.reownProjectId,networks:a,connectors:h,ssr:e.ssr}),k={adapters:[d],projectId:e.reownProjectId,networks:a,defaultNetwork:i,metadata:{name:e.appMetadata.name,description:e.appMetadata.description??"",url:e.appMetadata.url,icons:e.appMetadata.icons??[]},features:{email:!1,socials:!1,analytics:!1,onramp:!1,swaps:!1,send:!1,history:!1,receive:!1},allWallets:"HIDE",includeWalletIds:[...b],featuredWalletIds:[...b],enableNetworkSwitch:!1,enableCoinbase:!1,themeMode:N(e.theme)},A=I(k),W=d.wagmiConfig,l={appKit:A,wagmiConfig:W};return s.set(n,l),l}function D(t={}){return{providerKind:"reown",buildWagmiConfig(e){let{wagmiConfig:o}=T(e),n=[...e.extraConnectors.map(r=>r.registryEntry).filter(r=>r!==null),f("reown","walletConnect"),u("reown","walletConnect")];return{wagmiConfig:o,registryEntries:n}},async beforeConnect({kitConfig:e},o){if(!e.reownProjectId)return"defer";let n=s.get(e.reownProjectId);return!n||o==="metamask"&&p("io.metamask")||o==="binance"&&p("com.binance.wallet")?"defer":o==="metamask"||o==="binance"?O(n,o):"defer"},subscribeModalState({kitConfig:e},o){if(!e.reownProjectId)return()=>{};let n=s.get(e.reownProjectId);if(!n)return()=>{};let r;return n.appKit.subscribeState(a=>{let i=a.open===!0;i!==r&&(r=i,o(i))})},closeModal({kitConfig:e}){if(!e.reownProjectId)return;let o=s.get(e.reownProjectId);if(!o)return;let n=o.appKit.close;if(typeof n=="function")try{let r=n.call(o.appKit);r&&typeof r.then=="function"&&r.catch(()=>{})}catch{}}}}export{D as reownAdapter};
1
+ import{b as p}from"./chunk-FGGO4LLZ.js";import{c as f,d as u}from"./chunk-PQECHCC3.js";import"./chunk-TNPVFJYC.js";import{createAppKit as I}from"@reown/appkit";import{WagmiAdapter as E}from"@reown/appkit-adapter-wagmi";import{mainnet as m,sepolia as w,bsc as C,bscTestnet as y,defineChain as R}from"@reown/appkit/networks";import{resolveThemeMode as K}from"@nexus-cross/connect-kit-core";function N(t){return K(t,void 0)}var P=new Map([[m.id,m],[w.id,w],[C.id,C],[y.id,y]]),x="c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",B="8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",b=[x,B],M="eip155",j={binance:"binance",metamask:"metamask"},s=new Map;function v(t){return t.isReady()?Promise.resolve(!0):new Promise(e=>{let o=!1,n=setTimeout(()=>r(!1),2500),r=a=>{o||(o=!0,clearTimeout(n),e(a))};t.subscribeIsReady(({isReady:a})=>{a&&r(!0)})})}function g(t){t.appKit.open({view:"Connect"}).catch(e=>{typeof console<"u"&&console.warn("[crossx-kit] reownAdapter: appKit.open failed",e)})}async function O(t,e){let o=j[e];if(!o)return"defer";try{let{createAppKitWalletButton:n}=await import("@reown/appkit-wallet-button"),r=n({namespace:M});return await v(r)?(r.connect(o).catch(()=>{}),"handled"):(g(t),"handled")}catch{return g(t),"handled"}}function _(t){return R({id:t.id,chainNamespace:"eip155",caipNetworkId:`eip155:${t.id}`,name:t.name,nativeCurrency:t.nativeCurrency,rpcUrls:{default:{http:[t.rpcUrl]}},...t.blockExplorerUrl?{blockExplorers:{default:{name:"Explorer",url:t.blockExplorerUrl}}}:{},...t.testnet===void 0?{}:{testnet:t.testnet}})}function S(t){let e=[],o=!1;for(let n of t){let r=P.get(n.id);r?(e.push(r),o=!0):e.push(_(n))}if(!o)throw new Error(`[crossx-kit] reownAdapter: kitConfig.networks [${t.map(n=>n.id).join(", ")}] must include at least one Reown preset network (Ethereum mainnet/sepolia, BSC mainnet/testnet) so the WalletConnect relay has a recognized chain. CROSS and other custom EVM chains are now registered as custom networks, but cannot stand alone on the reown side \u2014 use toNexusAdapter for CROSS-only flows.`);return e}function T(t){let{kitConfig:e,extraConnectors:o}=t;if(!e.reownProjectId)throw new Error("[crossx-kit] reownAdapter requires CrossConnectKitConfig.reownProjectId \u2014 register a WalletConnect Cloud project at https://cloud.reown.com.");let n=e.reownProjectId,r=s.get(n);if(r)return r;let a=S(e.networks),i=e.defaultNetwork&&a.find(c=>c.id===e.defaultNetwork?.id)||a[0],h=o.map(c=>c.connector),d=new E({projectId:e.reownProjectId,networks:a,connectors:h,ssr:e.ssr}),k={adapters:[d],projectId:e.reownProjectId,networks:a,defaultNetwork:i,metadata:{name:e.appMetadata.name,description:e.appMetadata.description??"",url:e.appMetadata.url,icons:e.appMetadata.icons??[]},features:{email:!1,socials:!1,analytics:!1,onramp:!1,swaps:!1,send:!1,history:!1,receive:!1},allWallets:"HIDE",includeWalletIds:[...b],featuredWalletIds:[...b],enableNetworkSwitch:!1,enableCoinbase:!1,themeMode:N(e.theme)},A=I(k),W=d.wagmiConfig,l={appKit:A,wagmiConfig:W};return s.set(n,l),l}function D(t={}){return{providerKind:"reown",buildWagmiConfig(e){let{wagmiConfig:o}=T(e),n=[...e.extraConnectors.map(r=>r.registryEntry).filter(r=>r!==null),f("reown","walletConnect"),u("reown","walletConnect")];return{wagmiConfig:o,registryEntries:n}},async beforeConnect({kitConfig:e},o){if(!e.reownProjectId)return"defer";let n=s.get(e.reownProjectId);return!n||o==="metamask"&&p("io.metamask")||o==="binance"&&p("com.binance.wallet")?"defer":o==="metamask"||o==="binance"?O(n,o):"defer"},subscribeModalState({kitConfig:e},o){if(!e.reownProjectId)return()=>{};let n=s.get(e.reownProjectId);if(!n)return()=>{};let r;return n.appKit.subscribeState(a=>{let i=a.open===!0;i!==r&&(r=i,o(i))})},closeModal({kitConfig:e}){if(!e.reownProjectId)return;let o=s.get(e.reownProjectId);if(!o)return;let n=o.appKit.close;if(typeof n=="function")try{let r=n.call(o.appKit);r&&typeof r.then=="function"&&r.catch(()=>{})}catch{}}}}export{D as reownAdapter};
package/dist/to-nexus.js CHANGED
@@ -1 +1 @@
1
- import{a as g,b as C}from"./chunk-RT2R34G4.js";import"./chunk-33PCSJXD.js";import{WagmiAdapter as j}from"@to-nexus/appkit-adapter-wagmi";import{initCrossSdk as K,networkController as B,bscMainnet as h,bscTestnet as k,crossMainnet as y,crossTestnet as b,etherMainnet as x,etherTestnet as A,kaiaMainnet as N,kaiaTestnet as v,roninMainnet as W,roninTestnet as E}from"@to-nexus/sdk";import{ApiController as R,EventsController as L,ModalController as T,OptionsController as M,PublicStateController as D,RouterController as u}from"@to-nexus/appkit-core";import{resolveThemeMode as I}from"@nexus-cross/connect-kit-core";import{WALLET_LABELS as S}from"@nexus-cross/crossx-design-system";var $=new Map([[y.id,y],[b.id,b],[h.id,h],[k.id,k],[N.id,N],[v.id,v],[x.id,x],[A.id,A],[W.id,W],[E.id,E]]),m="cross_wallet",f="nexus.to.crosswallet.desktop";function Y(){let s=M.state.customWallets?.find(e=>e.id===m||e.rdns===f);return s||{id:m,name:S.default,image_url:"https://contents.crosstoken.io/wallet/token/images/CROSSx.svg",app_store:"https://apps.apple.com/us/app/crossx-games/id6741250674",play_store:"https://play.google.com/store/apps/details?id=com.nexus.crosswallet",chrome_store:"https://chromewebstore.google.com/detail/crossx/nninbdadmocnokibpaaohnoepbnpdgcg",rdns:f,mobile_link:"crossx://",desktop_link:"",webapp_link:"",injected:[{injected_id:f}]}}var p=new Map;function q(s){let e=[],t=[];for(let o of s){let r=$.get(o.id);r?e.push(r):t.push(o.id)}if(t.length)throw new Error(`[crossx-kit] toNexusAdapter: chain IDs [${t.join(", ")}] are not supported by @to-nexus/sdk presets. Either remove them from CrossConnectKitConfig.networks or switch to reownAdapter().`);return e}function G(s){try{let e=B,t=e?.getNetworks?.();if(Array.isArray(t)){t.length=0;for(let o of s)t.push(o)}typeof e.fetchNetworks=="function"&&(e.fetchNetworks=async()=>{})}catch(e){console.warn("[crossx-kit] toNexusAdapter: failed to constrain networkController",e)}}var _="@cross/active_caip_network_id";function H(s){try{if(typeof window>"u"||typeof localStorage>"u")return;let e=window.localStorage.getItem(_);if(!e)return;let t=new Set;for(let o of s){let r=o;r.caipNetworkId&&t.add(r.caipNetworkId),r.id!==void 0&&t.add(`eip155:${r.id}`)}if(t.has(e))return;window.localStorage.removeItem(_),console.warn(`[crossx-kit] toNexusAdapter: cleared persisted active network "${e}" (outside the DApp's registered set) so the CROSS session starts on the default chain.`)}catch(e){console.warn("[crossx-kit] toNexusAdapter: failed to clear persisted active network",e)}}function V(s){let{kitConfig:e,extraConnectors:t}=s,o=e.crossProjectId,r=p.get(o);if(r)return r;let n=q(e.networks),i=t.map(l=>l.connector),c=new j({projectId:o,networks:n,connectors:i,ssr:e.ssr}),a={name:e.appMetadata.name,description:e.appMetadata.description??"",url:e.appMetadata.url,icons:e.appMetadata.icons??[]},d=I(e.theme,e.autoDetectTheme);G(n),H(n);let O=K(o,e.appMetadata.url,a,d,n[0],[c],void 0,void 0,n);try{M.setEnableWallets(!0)}catch(l){console.warn("[crossx-kit] OptionsController.setEnableWallets failed",l)}let P=c.wagmiConfig,w={appKit:O,wagmiConfig:P,caipNetworks:n};return p.set(o,w),w}function z(s={}){let e=s.displayName??S.default;return{providerKind:"to-nexus",buildWagmiConfig(t){if(!t.kitConfig.crossProjectId)throw new Error("[crossx-kit] toNexusAdapter requires CrossConnectKitConfig.crossProjectId");let{wagmiConfig:o}=V(t),r=[...t.extraConnectors.map(n=>n.registryEntry).filter(n=>n!==null),g(e,"walletConnect"),C()];return{wagmiConfig:o,registryEntries:r}},async teardown(){},subscribeModalState({kitConfig:t},o){if(!t.crossProjectId)return()=>{};let n=p.get(t.crossProjectId)?.appKit.subscribeState;if(!n)return()=>{};let i;return n(c=>{let a=c.open===!0;a!==i&&(i=a,o(a))})},closeModal({kitConfig:t}){if(!t.crossProjectId)return;let o=p.get(t.crossProjectId);if(!o)return;let r=o.appKit.close;if(typeof r=="function")try{let n=r.call(o.appKit);n&&typeof n.then=="function"&&n.catch(()=>{})}catch{}},async beforeConnect({kitConfig:t,themeMode:o},r){if(r!==m||!t.crossProjectId)return"defer";let n=p.get(t.crossProjectId);if(!n)return"defer";let i=o??I(t.theme,t.autoDetectTheme);try{n.appKit.setThemeMode?.(i)}catch(d){typeof console<"u"&&console.warn("[crossx-kit] toNexusAdapter: setThemeMode failed",d)}let c=Y(),a=T.state.open;try{a||await R.prefetch(),u.state.view==="ConnectingWalletConnect"&&u.reset("Connect"),u.reset("ConnectingWalletConnect",{wallet:c}),a||(T.state.open=!0,D.set({open:!0}),L.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:!1}}))}catch(d){typeof console<"u"&&console.warn("[crossx-kit] toNexusAdapter: appKit.open failed",d)}return"defer"}}}export{z as toNexusAdapter};
1
+ import{a as g,b as C}from"./chunk-PQECHCC3.js";import"./chunk-TNPVFJYC.js";import{WagmiAdapter as j}from"@to-nexus/appkit-adapter-wagmi";import{initCrossSdk as K,networkController as B,bscMainnet as h,bscTestnet as k,crossMainnet as y,crossTestnet as b,etherMainnet as x,etherTestnet as A,kaiaMainnet as N,kaiaTestnet as v,roninMainnet as W,roninTestnet as E}from"@to-nexus/sdk";import{ApiController as R,EventsController as L,ModalController as T,OptionsController as M,PublicStateController as D,RouterController as u}from"@to-nexus/appkit-core";import{resolveThemeMode as I}from"@nexus-cross/connect-kit-core";import{WALLET_LABELS as S}from"@nexus-cross/crossx-design-system";var $=new Map([[y.id,y],[b.id,b],[h.id,h],[k.id,k],[N.id,N],[v.id,v],[x.id,x],[A.id,A],[W.id,W],[E.id,E]]),m="cross_wallet",f="nexus.to.crosswallet.desktop";function Y(){let s=M.state.customWallets?.find(e=>e.id===m||e.rdns===f);return s||{id:m,name:S.default,image_url:"https://contents.crosstoken.io/wallet/token/images/CROSSx.svg",app_store:"https://apps.apple.com/us/app/crossx-games/id6741250674",play_store:"https://play.google.com/store/apps/details?id=com.nexus.crosswallet",chrome_store:"https://chromewebstore.google.com/detail/crossx/nninbdadmocnokibpaaohnoepbnpdgcg",rdns:f,mobile_link:"crossx://",desktop_link:"",webapp_link:"",injected:[{injected_id:f}]}}var p=new Map;function q(s){let e=[],t=[];for(let o of s){let r=$.get(o.id);r?e.push(r):t.push(o.id)}if(t.length)throw new Error(`[crossx-kit] toNexusAdapter: chain IDs [${t.join(", ")}] are not supported by @to-nexus/sdk presets. Either remove them from CrossConnectKitConfig.networks or switch to reownAdapter().`);return e}function G(s){try{let e=B,t=e?.getNetworks?.();if(Array.isArray(t)){t.length=0;for(let o of s)t.push(o)}typeof e.fetchNetworks=="function"&&(e.fetchNetworks=async()=>{})}catch(e){console.warn("[crossx-kit] toNexusAdapter: failed to constrain networkController",e)}}var _="@cross/active_caip_network_id";function H(s){try{if(typeof window>"u"||typeof localStorage>"u")return;let e=window.localStorage.getItem(_);if(!e)return;let t=new Set;for(let o of s){let r=o;r.caipNetworkId&&t.add(r.caipNetworkId),r.id!==void 0&&t.add(`eip155:${r.id}`)}if(t.has(e))return;window.localStorage.removeItem(_),console.warn(`[crossx-kit] toNexusAdapter: cleared persisted active network "${e}" (outside the DApp's registered set) so the CROSS session starts on the default chain.`)}catch(e){console.warn("[crossx-kit] toNexusAdapter: failed to clear persisted active network",e)}}function V(s){let{kitConfig:e,extraConnectors:t}=s,o=e.crossProjectId,r=p.get(o);if(r)return r;let n=q(e.networks),i=t.map(l=>l.connector),c=new j({projectId:o,networks:n,connectors:i,ssr:e.ssr}),a={name:e.appMetadata.name,description:e.appMetadata.description??"",url:e.appMetadata.url,icons:e.appMetadata.icons??[]},d=I(e.theme,e.autoDetectTheme);G(n),H(n);let O=K(o,e.appMetadata.url,a,d,n[0],[c],void 0,void 0,n);try{M.setEnableWallets(!0)}catch(l){console.warn("[crossx-kit] OptionsController.setEnableWallets failed",l)}let P=c.wagmiConfig,w={appKit:O,wagmiConfig:P,caipNetworks:n};return p.set(o,w),w}function z(s={}){let e=s.displayName??S.default;return{providerKind:"to-nexus",buildWagmiConfig(t){if(!t.kitConfig.crossProjectId)throw new Error("[crossx-kit] toNexusAdapter requires CrossConnectKitConfig.crossProjectId");let{wagmiConfig:o}=V(t),r=[...t.extraConnectors.map(n=>n.registryEntry).filter(n=>n!==null),g(e,"walletConnect"),C()];return{wagmiConfig:o,registryEntries:r}},async teardown(){},subscribeModalState({kitConfig:t},o){if(!t.crossProjectId)return()=>{};let n=p.get(t.crossProjectId)?.appKit.subscribeState;if(!n)return()=>{};let i;return n(c=>{let a=c.open===!0;a!==i&&(i=a,o(a))})},closeModal({kitConfig:t}){if(!t.crossProjectId)return;let o=p.get(t.crossProjectId);if(!o)return;let r=o.appKit.close;if(typeof r=="function")try{let n=r.call(o.appKit);n&&typeof n.then=="function"&&n.catch(()=>{})}catch{}},async beforeConnect({kitConfig:t,themeMode:o},r){if(r!==m||!t.crossProjectId)return"defer";let n=p.get(t.crossProjectId);if(!n)return"defer";let i=o??I(t.theme,t.autoDetectTheme);try{n.appKit.setThemeMode?.(i)}catch(d){typeof console<"u"&&console.warn("[crossx-kit] toNexusAdapter: setThemeMode failed",d)}let c=Y(),a=T.state.open;try{a||await R.prefetch(),u.state.view==="ConnectingWalletConnect"&&u.reset("Connect"),u.reset("ConnectingWalletConnect",{wallet:c}),a||(T.state.open=!0,D.set({open:!0}),L.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:!1}}))}catch(d){typeof console<"u"&&console.warn("[crossx-kit] toNexusAdapter: appKit.open failed",d)}return"defer"}}}export{z as toNexusAdapter};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexus-cross/connect-kit-wagmi",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "description": "wagmi connector adapters for @nexus-cross/connect-kit — embedded wallet, WalletConnect",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,8 +34,8 @@
34
34
  "dependencies": {
35
35
  "@nexus-cross/crossx-sdk-core": "2.3.7",
36
36
  "@nexus-cross/crossx-sdk-wagmi": "2.3.7",
37
- "@nexus-cross/connect-kit-core": "1.3.7",
38
- "@nexus-cross/crossx-design-system": "1.3.7"
37
+ "@nexus-cross/connect-kit-core": "1.3.8",
38
+ "@nexus-cross/crossx-design-system": "1.3.8"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@reown/appkit": "^1.8.19",
@@ -1 +0,0 @@
1
- var l='<svg preserveAspectRatio="none" width="100%" height="100%" overflow="visible" style="display: block;" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#c0)"><path d="M18 36C27.9411 36 36 27.9411 36 18C36 8.05887 27.9411 0 18 0C8.05887 0 0 8.05887 0 18C0 27.9411 8.05887 36 18 36Z" fill="#00D5AA"/><path fill-rule="evenodd" clip-rule="evenodd" d="M18.2903 2.57169L21.3525 5.63385V10.6471L25.3058 6.69381L29.6364 11.0244L25.7226 14.9381H18.2903C16.5992 14.9381 15.2283 16.309 15.2283 18.0003C15.2283 19.6915 16.5992 21.0624 18.2903 21.0624H25.6836L29.6365 25.0154L25.3059 29.3459L21.3525 25.3925V30.3666L18.2903 33.4288L15.2283 30.3666V25.4326L11.3148 29.3459L6.98426 25.0154L10.9372 21.0624H5.92394L2.86178 18.0003L5.92394 14.9381H10.8981L6.98437 11.0244L11.3149 6.69383L15.2283 10.6071V5.63385L18.2903 2.57169Z" fill="#000"/></g><defs><clipPath id="c0"><rect width="36" height="36" fill="#fff"/></clipPath></defs></svg>',i='<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 28 28" fill="none"><g clip-path="url(#m0)"><path d="M26.07 26.93L20.06 25.07L15.53 27.88L12.37 27.88L7.83 25.07L1.83 26.93L0 20.53L1.83 13.44L0 7.44L1.83 0L11.21 5.81H16.69L26.07 0L27.9 7.44L26.07 13.44L27.9 20.53Z" fill="#FF5C16"/><path d="M7.83 20.54L11.96 23.8L7.83 25.07V20.54Z" fill="#FF5C16"/><path d="M20.06 20.54L15.93 23.8L20.06 25.07L20.06 20.54Z" fill="#FF5C16"/><path d="M11.63 15.14L12.78 22.85L11.19 18.56L5.77 17.17L7.83 15.14H11.63Z" fill="#E34807"/><path d="M16.27 15.14L15.12 22.85L16.71 18.56L22.13 17.17L20.07 15.14H16.27Z" fill="#E34807"/><path d="M0 20.53L1.83 13.44H5.76L5.77 17.17L11.19 18.56L12.78 22.85L11.96 23.79L7.83 20.53H0Z" fill="#FF8D5D"/><path d="M27.9 20.53L26.07 13.44H22.14L22.13 17.17L16.71 18.56L15.12 22.85L15.94 23.79L20.07 20.53H27.9Z" fill="#FF8D5D"/><path d="M16.69 5.81H11.21L10.84 9.81L12.78 22.85H15.12L17.06 9.81L16.69 5.81Z" fill="#FF8D5D"/><path d="M15.53 25.34V27.88H12.37V25.34H15.53Z" fill="#C0C4CD"/><path d="M7.83 25.07L12.37 27.88V25.34L11.96 23.79L7.83 25.07Z" fill="#E7EBF6"/><path d="M20.07 25.07L15.53 27.88V25.34L15.94 23.79L20.07 25.07Z" fill="#E7EBF6"/></g><defs><clipPath id="m0"><rect width="28" height="28" fill="#fff"/></clipPath></defs></svg>',h='<svg width="100%" height="100%" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.23 16.81L20 9.04L27.77 16.81L32.29 12.29L20 0L7.71 12.29L12.23 16.81Z" fill="#F3BA2F"/><path d="M9.04 20L4.52 15.48L0 20L4.52 24.52L9.04 20Z" fill="#F3BA2F"/><path d="M12.23 23.19L20 30.96L27.77 23.19L32.29 27.71L20 40L7.71 27.71L12.23 23.19Z" fill="#F3BA2F"/><path d="M35.48 24.52L40 20L35.48 15.48L30.96 20L35.48 24.52Z" fill="#F3BA2F"/><path d="M24.58 20L20 15.41L16.61 18.8L16.22 19.19L15.42 19.99L20 24.59L24.59 20L24.58 20Z" fill="#F3BA2F"/></svg>',p='<svg width="100%" height="100%" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="40" height="40" rx="8" fill="#3B99FC" fill-opacity="0.1"/><path d="M14.5 17C17.5 14 22.5 14 25.5 17L25.9 17.4C26.1 17.6 26.1 17.9 25.9 18.1L24.7 19.3C24.6 19.4 24.4 19.4 24.3 19.3L23.8 18.8C21.7 16.7 18.3 16.7 16.2 18.8L15.6 19.4C15.5 19.5 15.3 19.5 15.2 19.4L14 18.2C13.8 18 13.8 17.7 14 17.5L14.5 17Z" fill="#3B99FC"/><path d="M28 19.5L29 20.5C29.2 20.7 29.2 21 29 21.2L23.5 26.7C23.3 26.9 23 26.9 22.8 26.7L19.2 23.1C19.15 23.05 19.05 23.05 19 23.1L15.4 26.7C15.2 26.9 14.9 26.9 14.7 26.7L9.2 21.2C9 21 9 20.7 9.2 20.5L10.2 19.5C10.4 19.3 10.7 19.3 10.9 19.5L14.5 23.1C14.55 23.15 14.65 23.15 14.7 23.1L18.3 19.5C18.5 19.3 18.8 19.3 19 19.5L22.6 23.1C22.65 23.15 22.75 23.15 22.8 23.1L26.4 19.5C26.6 19.3 26.9 19.3 27.1 19.5L28 19.5Z" fill="#3B99FC"/></svg>',C='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><path fill="#FFC107" d="M43.6 20.5H42V20H24v8h11.3A12 12 0 1 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 1 0 44 24c0-1.2-.1-2.4-.4-3.5z"/><path fill="#FF3D00" d="M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.2 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z"/><path fill="#4CAF50" d="M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28l-6.5 5A20 20 0 0 0 24 44z"/><path fill="#1976D2" d="M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4.1 5.5l6.3 5.3C41 35.7 44 30.3 44 24c0-1.2-.1-2.4-.4-3.5z"/></svg>',e='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000"><path d="M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.53 4.08zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"/></svg>';function L(t){return`data:image/svg+xml,${encodeURIComponent(t)}`}var o=L(l),s=L(l),f=L(i),d=L(h),a=L(p),g=L(C),n=L(e);export{o as a,s as b,f as c,d,a as e,g as f,n as g};