@nexus-cross/connect-kit-wagmi 1.3.3-beta.9 → 1.3.4-beta.1
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.
- package/dist/index.js +1 -1
- package/dist/to-nexus.js +1 -1
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as U,b as F}from"./chunk-6BKDRLN2.js";import{a as Q,c as $,d as V}from"./chunk-MB7252C7.js";import{a as
|
|
1
|
+
import{a as U,b as F}from"./chunk-6BKDRLN2.js";import{a as Q,c as $,d as V}from"./chunk-MB7252C7.js";import{a as y,b as L,c as H,d as q,e as G,f as X,g as Y}from"./chunk-33PCSJXD.js";import{defaultDesignSystem as ce,toSdkColorOverrides as P}from"@nexus-cross/crossx-design-system";var g=new Set;function z(e){return g.add(e),()=>{g.delete(e)}}function N(){g.forEach(e=>e())}function w(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 J(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 Z}from"@wagmi/core";var _="crossx";function ee(e){return typeof e=="object"&&e!==null&&e.code==="ALREADY_AUTHENTICATED"}function S(e){async function o(){let r=e.connectors.find(t=>t.id===_);if(r)try{await Z(e,{connector:r})}catch{}}return{async signIn(r){let t=e.connectors.find(c=>c.id===_);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(ee(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()}}}var te=612055,oe=612044,re=56,ne=97,se={id:612055,name:"CROSS Mainnet",nativeCurrency:{name:"CROSS",symbol:"CROSS",decimals:18},rpcUrl:"https://mainnet.crosstoken.io:22001",blockExplorerUrl:"https://www.crossscan.io",testnet:!1},ie={id:612044,name:"CROSS Testnet",nativeCurrency:{name:"tCROSS",symbol:"tCROSS",decimals:18},rpcUrl:"https://testnet.crosstoken.io:22001",blockExplorerUrl:"https://testnet.crossscan.io",testnet:!0},A={id:56,name:"BSC Mainnet",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrl:"https://bsc-mainnet.crosstoken.io/2272489872e4f1475ff25d57ce93b51989f933c7",blockExplorerUrl:"https://bscscan.com",testnet:!1},O={id:97,name:"BSC Testnet",nativeCurrency:{name:"tBNB",symbol:"tBNB",decimals:18},rpcUrl:"https://bsc-testnet.crosstoken.io/110ea3628b77f244e5dbab16790d81bba874b962",blockExplorerUrl:"https://testnet.bscscan.com",testnet:!0},T={612055:A,612044:O};function x(e){let o=new Set(e.map(t=>t.id)),r=[];for(let t of e){let n=T[t.id];n&&!o.has(n.id)&&(r.push(n),o.add(n.id))}return r.length===0?e:[...e,...r]}function v(e){let o=new Set(e.map(t=>t.id)),r=[];for(let t of e){let n=T[t.id];n&&!o.has(n.id)&&(r.push(n),o.add(n.id))}return r}var ae="crossx-kit:active-provider";function de(e){let{crossProvider:o,reownProvider:r,embeddedConnectorFactory:t,walletGuides:n,defaultProvider:i,disableBscAutoRegister:d,designSystem:l=ce,...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 W={light:P(l,"light"),dark:P(l,"dark")},u=d?c:{...c,networks:x(c.networks)},f={...u,themeTokens:u.themeTokens??W,restoreChainAfterSwitch:u.restoreChainAfterSwitch??!0};if(!d){let s=v(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,m=[];if(o){let s=[],a=t?t(f,N):null;a&&s.push({connector:a,registryEntry:{walletId:"cross_embedded",providerKind:"cross",type:"embedded",connectorId:"crossx",name:"CROSSx",iconUrl:y}});let k=o.buildWagmiConfig({kitConfig:f,extraConnectors:s});C=k.wagmiConfig,m.push(...k.registryEntries)}let I=null,E=[];if(r){let s=r.buildWagmiConfig({kitConfig:f,extraConnectors:[]});I=s.wagmiConfig,E.push(...s.registryEntries)}let h=[...m,...E],D=n?h.map(s=>{let a=n[s.walletId];return a?{...s,guideUrl:a.url,guideLabel:a.label}:s}):h,K=w(D),B=i??(C?"cross":"reown"),M=m.some(s=>s.walletId==="cross_embedded"),j=C&&M?S(C):null;return{kitConfig:f,crossWagmiConfig:C,reownWagmiConfig:I,connectorRegistry:K,crossProvider:o??null,reownProvider:r??null,defaultProvider:B,activeProviderStorageKey:ae,oauth:j,designSystem:l}}var R=["wc@","@w3m","@walletconnect","@appkit","wagmi"];function le(e=R){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 b}from"wagmi";function Ce(e,o){if(!o)return;let r={cross:e.crossWagmiConfig?b(e.crossWagmiConfig,o):void 0,reown:e.reownWagmiConfig?b(e.reownWagmiConfig,o):void 0};return r.cross||r.reown?r:void 0}function fe(e,o){if(e)return o==="cross"?e.cross:e.reown}import{injected as pe}from"wagmi/connectors";function p(){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 ue(){return pe({target(){let e=p();return e?{id:"nexus.to.crosswallet.desktop",name:"CROSSx Extension",provider:e}:{id:"nexus.to.crosswallet.desktop",name:"CROSSx Extension",provider:{request:async o=>{let r=p();if(!r)throw new Error("CROSSx Extension is not installed. Please install it and refresh.");return r.request(o)},on:(...o)=>{p()?.on?.(...o)},removeListener:(...o)=>{p()?.removeListener?.(...o)}}}}})}import{walletConnect as me}from"wagmi/connectors";function ye(e){return me({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{Y as APPLE_ICON,q as BINANCE_ICON,re as BSC_MAINNET_CHAIN_ID,ne as BSC_TESTNET_CHAIN_ID,y as CROSSX_ICON,te as CROSS_MAINNET_CHAIN_ID,oe as CROSS_TESTNET_CHAIN_ID,R as DEFAULT_SESSION_STORAGE_PREFIXES,Q as DEFAULT_WALLET_REGISTRY,L as EXTENSION_ICON,X as GOOGLE_ICON,H as METAMASK_ICON,G as WALLETCONNECT_ICON,A as bscMainnetNetwork,O as bscTestnetNetwork,le as clearWalletSessionStorage,Ce as cookieToCrossConnectKitState,w as createConnectorRegistry,de as createCrossxConfig,S as createCrossySdkOAuthAdapter,ye as createWalletConnectConnector,ue as crossExtensionConnector,se as crossMainnetNetwork,ie as crossTestnetNetwork,V as debugDetect,F as deriveSDKThemeTokensFromWalletInfo,$ as detectWallets,z as onOpenOtherWallets,fe as pickInitialState,U as readWalletInfoTokens,J as resolveCurrentWallet,x as withRequiredBscPairs};
|
package/dist/to-nexus.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g,b as
|
|
1
|
+
import{a as g,b as C}from"./chunk-UVGOTXNW.js";import"./chunk-33PCSJXD.js";import{WagmiAdapter as P}from"@to-nexus/appkit-adapter-wagmi";import{initCrossSdk as j,networkController as K,bscMainnet as h,bscTestnet as k,crossMainnet as y,crossTestnet as x,etherMainnet as b,etherTestnet as N,kaiaMainnet as v,kaiaTestnet as A,roninMainnet as W,roninTestnet as S}from"@to-nexus/sdk";import{ApiController as R,EventsController as B,ModalController as E,OptionsController as _,PublicStateController as D,RouterController as u}from"@to-nexus/appkit-core";import{resolveThemeMode as M}from"@nexus-cross/connect-kit-core";var L=new Map([[y.id,y],[x.id,x],[h.id,h],[k.id,k],[v.id,v],[A.id,A],[b.id,b],[N.id,N],[W.id,W],[S.id,S]]),m="cross_wallet",f="nexus.to.crosswallet.desktop";function $(){let s=_.state.customWallets?.find(e=>e.id===m||e.rdns===f);return s||{id:m,name:"CROSSx Wallet",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 Y(s){let e=[],t=[];for(let o of s){let r=L.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 q(s){try{let e=K,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 T="@cross/active_caip_network_id";function G(s){try{if(typeof window>"u"||typeof localStorage>"u")return;let e=window.localStorage.getItem(T);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(T),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 H(s){let{kitConfig:e,extraConnectors:t}=s,o=e.crossProjectId,r=p.get(o);if(r)return r;let n=Y(e.networks),i=t.map(l=>l.connector),c=new P({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=M(e.theme,e.autoDetectTheme);q(n),G(n);let I=j(o,e.appMetadata.url,a,d,n[0],[c],void 0,void 0,n);try{_.setEnableWallets(!0)}catch(l){console.warn("[crossx-kit] OptionsController.setEnableWallets failed",l)}let O=c.wagmiConfig,w={appKit:I,wagmiConfig:O,caipNetworks:n};return p.set(o,w),w}function V(s={}){let e=s.displayName??"CROSSx Wallet";return{providerKind:"to-nexus",buildWagmiConfig(t){if(!t.kitConfig.crossProjectId)throw new Error("[crossx-kit] toNexusAdapter requires CrossConnectKitConfig.crossProjectId");let{wagmiConfig:o}=H(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??M(t.theme,t.autoDetectTheme);try{n.appKit.setThemeMode?.(i)}catch(d){typeof console<"u"&&console.warn("[crossx-kit] toNexusAdapter: setThemeMode failed",d)}let c=$(),a=E.state.open;try{a||await R.prefetch(),u.state.view==="ConnectingWalletConnect"&&u.reset("Connect"),u.reset("ConnectingWalletConnect",{wallet:c}),a||(E.state.open=!0,D.set({open:!0}),B.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{V as toNexusAdapter};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexus-cross/connect-kit-wagmi",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4-beta.1",
|
|
4
4
|
"description": "wagmi connector adapters for @nexus-cross/connect-kit — embedded wallet, WalletConnect",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -32,19 +32,19 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@nexus-cross/crossx-sdk-core": "2.3.3
|
|
36
|
-
"@nexus-cross/crossx-sdk-wagmi": "2.3.3
|
|
37
|
-
"@nexus-cross/connect-kit-core": "1.3.
|
|
38
|
-
"@nexus-cross/crossx-design-system": "1.3.
|
|
35
|
+
"@nexus-cross/crossx-sdk-core": "2.3.3",
|
|
36
|
+
"@nexus-cross/crossx-sdk-wagmi": "2.3.3",
|
|
37
|
+
"@nexus-cross/connect-kit-core": "1.3.4-beta.1",
|
|
38
|
+
"@nexus-cross/crossx-design-system": "1.3.4-beta.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@reown/appkit": "^1.8.19",
|
|
42
42
|
"@reown/appkit-adapter-wagmi": "^1.8.19",
|
|
43
43
|
"@reown/appkit-wallet-button": "^1.8.19",
|
|
44
|
-
"@to-nexus/appkit-adapter-wagmi": "^1.19.
|
|
45
|
-
"@to-nexus/appkit-common": "^1.19.
|
|
46
|
-
"@to-nexus/appkit-core": "^1.19.
|
|
47
|
-
"@to-nexus/sdk": "^1.19.
|
|
44
|
+
"@to-nexus/appkit-adapter-wagmi": "^1.19.5",
|
|
45
|
+
"@to-nexus/appkit-common": "^1.19.5",
|
|
46
|
+
"@to-nexus/appkit-core": "^1.19.5",
|
|
47
|
+
"@to-nexus/sdk": "^1.19.5",
|
|
48
48
|
"@wagmi/core": ">=2.0.0 <4",
|
|
49
49
|
"viem": "^2.0.0",
|
|
50
50
|
"wagmi": ">=2.0.0 <4"
|
|
@@ -76,10 +76,10 @@
|
|
|
76
76
|
"@reown/appkit": "1.8.19",
|
|
77
77
|
"@reown/appkit-adapter-wagmi": "1.8.19",
|
|
78
78
|
"@reown/appkit-wallet-button": "1.8.19",
|
|
79
|
-
"@to-nexus/appkit-adapter-wagmi": "1.19.
|
|
80
|
-
"@to-nexus/appkit-common": "1.19.
|
|
81
|
-
"@to-nexus/appkit-core": "1.19.
|
|
82
|
-
"@to-nexus/sdk": "1.19.
|
|
79
|
+
"@to-nexus/appkit-adapter-wagmi": "1.19.5",
|
|
80
|
+
"@to-nexus/appkit-common": "1.19.5",
|
|
81
|
+
"@to-nexus/appkit-core": "1.19.5",
|
|
82
|
+
"@to-nexus/sdk": "1.19.5",
|
|
83
83
|
"@wagmi/core": "^3.4.0",
|
|
84
84
|
"tsup": "^8.4.0",
|
|
85
85
|
"typescript": "^5.7.0",
|