@nexus-cross/crossx-sdk-wagmi 2.3.10-beta.6 → 2.3.10

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/README.md CHANGED
@@ -23,7 +23,7 @@ import { createConfig, http } from 'wagmi';
23
23
  import { crossxConnector } from '@nexus-cross/crossx-sdk-wagmi';
24
24
  import type { Chain } from 'viem';
25
25
 
26
- const crossMainnet = {
26
+ const oneMainnet = {
27
27
  id: 612055,
28
28
  name: 'CROSS Mainnet',
29
29
  nativeCurrency: { name: 'CROSS', symbol: 'CROSS', decimals: 18 },
@@ -31,7 +31,7 @@ const crossMainnet = {
31
31
  } as const satisfies Chain;
32
32
 
33
33
  const config = createConfig({
34
- chains: [crossMainnet],
34
+ chains: [oneMainnet],
35
35
  connectors: [
36
36
  crossxConnector({
37
37
  projectId: 'your-project-id',
@@ -39,7 +39,7 @@ const config = createConfig({
39
39
  }),
40
40
  ],
41
41
  transports: {
42
- [crossMainnet.id]: http(),
42
+ [oneMainnet.id]: http(),
43
43
  },
44
44
  });
45
45
  ```
@@ -60,15 +60,15 @@ const sdk = createCROSSxSDK({
60
60
  });
61
61
 
62
62
  const config = createConfig({
63
- chains: [crossMainnet],
63
+ chains: [oneMainnet],
64
64
  connectors: [
65
65
  createCROSSxConnector({
66
66
  sdk,
67
- defaultChainId: ChainId.CROSS_MAINNET,
67
+ defaultChainId: ChainId.ONE_MAINNET,
68
68
  }),
69
69
  ],
70
70
  transports: {
71
- [crossMainnet.id]: http(),
71
+ [oneMainnet.id]: http(),
72
72
  },
73
73
  });
74
74
  ```
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("wagmi"),B=require("viem"),y=require("@nexus-cross/crossx-sdk-core");function Q(r){return parseInt(r.split(":")[1]??"1",10)}function k(r){return`eip155:${r}`}function M(r){return"0x"+r.toString(16)}function F(r){const t=r.startsWith("0x")?r.slice(2):r,i=new Uint8Array(t.length/2);for(let n=0;n<i.length;n++)i[n]=parseInt(t.substring(n*2,n*2+2),16);return new TextDecoder().decode(i)}class H{constructor(t,i=y.ChainId.CROSS_MAINNET){this.sdk=t,this.listeners=new Map,this.walletIndex=0,this.currentAccounts=[],this.off=this.removeListener.bind(this),this.chainId=typeof i=="number"?i:Q(i),this.sdk.on("addressChanged",({address:n,index:u})=>{this.setWalletIndex(u),this.notifyAccountsChanged([n])})}_setWalletIndexChangeCallback(t){this.walletIndexChangeCallback=t}async request({method:t,params:i}){try{return await this._handleRequest(t,i)}catch(n){throw n instanceof y.CROSSxError&&n.code===y.ErrorCode.USER_REJECTED?Object.assign(new Error("User rejected the request"),{code:4001,data:n.details}):n}}async _handleRequest(t,i){var u;const n=i??[];switch(t){case"eth_requestAccounts":case"eth_accounts":{if(this.currentAccounts.length>0)return[...this.currentAccounts];const e=await this.sdk.getAddress();return e?[e.address]:[]}case"eth_chainId":return M(this.chainId);case"net_version":return String(this.chainId);case"personal_sign":{const[e]=n,o=e.startsWith("0x")?F(e):e;return(await this.sdk.signMessage(k(this.chainId),o,{index:this.walletIndex})).signature}case"eth_sign":{const[,e]=n,o=e.startsWith("0x")?F(e):e;return(await this.sdk.signMessage(k(this.chainId),o,{index:this.walletIndex})).signature}case"eth_signTypedData":case"eth_signTypedData_v3":case"eth_signTypedData_v4":{const[,e]=n,o=typeof e=="string"?JSON.parse(e):e,f=(u=o==null?void 0:o.domain)==null?void 0:u.chainId,x=f==null||f===0,p=x?0:Number(f),m={index:this.walletIndex};return(x?await this.sdk.signTypedDataOffchain(o,m):await this.sdk.signTypedData(k(p),o,m)).signature}case"eth_sendTransaction":{const[e]=n,o=k(this.chainId);return(await this.sdk.sendTransaction(o,{from:e.from,to:e.to,value:e.value,data:e.data,gasLimit:e.gasLimit??e.gas,gasPrice:e.gasPrice,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce!==void 0?parseInt(String(e.nonce),16):void 0,chainId:this.chainId},{index:this.walletIndex})).txHash}case"wallet_switchEthereumChain":{const[{chainId:e}]=n,o=parseInt(e,16);return o!==this.chainId&&(this.chainId=o,this.emit("chainChanged",M(o))),null}case"wallet_addEthereumChain":return null;default:return this.sdk.walletRpc(t,n,k(this.chainId))}}on(t,i){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(i),this}removeListener(t,i){var n;return(n=this.listeners.get(t))==null||n.delete(i),this}emit(t,...i){var n;(n=this.listeners.get(t))==null||n.forEach(u=>u(...i))}notifyAccountsChanged(t){this.currentAccounts=t,this.emit("accountsChanged",t)}notifyDisconnect(t){this.currentAccounts=[],this.walletIndex=0,this.emit("disconnect",t)}getCurrentChainId(){return this.chainId}setChainId(t){t!==this.chainId&&(this.chainId=t,this.emit("chainChanged",M(t)))}setWalletIndex(t){var i;this.walletIndex=t,(i=this.walletIndexChangeCallback)==null||i.call(this,t)}getWalletIndex(){return this.walletIndex}getCurrentAccounts(){return[...this.currentAccounts]}}function X(r){return typeof r=="number"?r:parseInt(r.split(":")[1]??"1",10)}const U="crossx-wallet-index";function V(){try{const r=typeof window<"u"?localStorage.getItem(U):null;return r&&Number(r)||0}catch{return 0}}function Z(r){try{typeof window<"u"&&localStorage.setItem(U,String(r))}catch{}}function K(){try{typeof window<"u"&&localStorage.removeItem(U)}catch{}}const j="crossx-wallet-address";function tt(){try{return typeof window<"u"?localStorage.getItem(j):null}catch{return null}}function et(r){try{typeof window<"u"&&localStorage.setItem(j,r)}catch{}}function nt(){try{typeof window<"u"&&localStorage.removeItem(j)}catch{}}function st(r){const{defaultChainId:t,getStoredWalletIndex:i,onWalletIndexChanged:n,getStoredWalletAddress:u,onWalletAddressChanged:e,clearStoredWalletAddress:o,openConnectOtherWallet:f,...x}=r;if(f){const m=x.connectOtherWallets,W=Array.isArray(m)&&m.length>0,A=x.showConnectOtherWallets===!0;!W&&!A&&(x.showConnectOtherWallets=!0)}const p=y.createCROSSxSDK(x);return J({sdk:p,defaultChainId:t,getStoredWalletIndex:i,onWalletIndexChanged:n,getStoredWalletAddress:u,onWalletAddressChanged:e,clearStoredWalletAddress:o,openConnectOtherWallet:f})}function J(r){const{sdk:t,defaultChainId:i=y.ChainId.CROSS_MAINNET,getStoredWalletIndex:n=V,onWalletIndexChanged:u=Z,getStoredWalletAddress:e=tt,onWalletAddressChanged:o=et,clearStoredWalletAddress:f=nt,openConnectOtherWallet:x}=r,p=X(i);let m=null,W=!1,A=null,z=!1,v=!1,L=!1,S=null,D=!1;function N(I){const O=S;return O?(S=null,D=!1,O(I),!0):!1}function C(){return m||(m=new H(t,p),m._setWalletIndexChangeCallback(u)),m}return $.createConnector(I=>{function O(s){if(z)return;const l=C();l.on("accountsChanged",s.onAccountsChanged.bind(s)),l.on("chainChanged",s.onChainChanged.bind(s)),l.on("disconnect",s.onDisconnect.bind(s)),z=!0}function q(s){const l=C();l.notifyAccountsChanged([s]),I.emitter.emit("connect",{accounts:[s],chainId:l.getCurrentChainId()})}async function G(){if(!W)return A||(A=(async()=>{const s=n(),l=e()??void 0;await t.initialize({preferredWalletIndex:s,preferredWalletAddress:l}),t.on("addressChanged",({address:a,index:d})=>{if(v){D&&a&&t.isAuthenticated()&&S&&(C().setWalletIndex(d),o(a),N(a));return}const b=C();b.setWalletIndex(d),a&&(o(a),t.isAuthenticated()?q(a):b.notifyAccountsChanged([a]))}),t.on("authChanged",a=>{if(a.isAuthenticated&&a.source==="external"&&S){if(a.address){N(a.address);return}D=!0,t.getAddress().then(d=>{d!=null&&d.address&&t.isAuthenticated()&&N(d.address)}).catch(()=>{});return}if(!(v||L)){if(a.isAuthenticated){if(a.address){q(a.address);return}t.getAddress().then(d=>{d!=null&&d.address&&t.isAuthenticated()&&q(d.address)}).catch(()=>{});return}C().notifyDisconnect(),K(),f(),u(0),I.emitter.emit("disconnect")}}),x&&t.on("connectExternalWallet",x),W=!0})().finally(()=>{A=null}),A)}return{id:"crossx",name:y.WALLET_BRAND_NAME,type:"crossx",async setup(){await G(),O(this)},async connect({chainId:s,isReconnecting:l}={}){const a=s??p;v=!0;const d=new Promise(w=>{S=w}),b=this,Y=async()=>{await G(),O(b);const w=C();if(t.isAuthenticated()){const c=await t.getAddress();if(c)return w.setWalletIndex(c.index),w.notifyAccountsChanged([c.address]),{accounts:[c.address],chainId:a};if(l)throw new Error("CROSSx reconnect: authenticated session has no active wallet address");await t.signOut().catch(()=>{}),w.notifyDisconnect()}if(l)throw new Error("CROSSx reconnect: no authenticated session to restore");const _=e();let g;try{g=await t.signInWithCreate({preferredWalletAddress:_??void 0})}catch(c){throw c instanceof y.CROSSxError&&c.code===y.ErrorCode.EXTERNAL_WALLET_REQUESTED?(w.notifyDisconnect(),new B.UserRejectedRequestError(c)):(t.isAuthenticated()||(w.notifyDisconnect(),I.emitter.emit("disconnect")),c)}if(!g.success)throw new Error(g.error??"CROSSx sign-in failed");const h=g.address,E=g.addresses.map(c=>c.address).filter(c=>!h||c.toLowerCase()!==h.toLowerCase()),T=h?[h,...E]:E;if(T.length===0)throw new Error("No address found after sign-in");const R=g.addresses.find(c=>h&&c.address.toLowerCase()===h.toLowerCase()),P=(R==null?void 0:R.index)??0;return w.setWalletIndex(P),w.notifyAccountsChanged(T),h&&o(h),{accounts:T,chainId:a}};try{const w=Y();w.catch(()=>{});const _=await Promise.race([w.then(g=>({kind:"inner",value:g})),d.then(g=>({kind:"external",address:g}))]);if(_.kind==="external"){const g=C(),h=await t.getAddress().catch(()=>null),E=(h==null?void 0:h.address)??_.address,R=(await t.getAddresses().catch(()=>[])).map(c=>c.address).filter(c=>c.toLowerCase()!==E.toLowerCase()),P=[E,...R];return g.setWalletIndex((h==null?void 0:h.index)??0),g.notifyAccountsChanged(P),o(E),{accounts:P,chainId:a}}return _.value}finally{v=!1,S=null,D=!1}},async disconnect(){L=!0;try{const s=C();await t.signOut(),s.notifyDisconnect(),K(),f(),u(0),I.emitter.emit("disconnect")}finally{L=!1}},async getAccounts(){const l=C().getCurrentAccounts();if(l.length>0)return l;const a=await t.getAddress();return a?[a.address]:[]},async getChainId(){return C().getCurrentChainId()},async getProvider({chainId:s}={}){return C()},async isAuthorized(){return await G(),t.isAuthenticated()},async switchChain({chainId:s}){C().setChainId(s),I.emitter.emit("change",{chainId:s});const a=I.chains.find(d=>d.id===s);if(!a)throw new Error(`Chain ${s} is not configured`);return a},onAccountsChanged(s){s.length===0?I.emitter.emit("disconnect"):I.emitter.emit("change",{accounts:s})},onChainChanged(s){I.emitter.emit("change",{chainId:Number(s)})},onDisconnect(){I.emitter.emit("disconnect")}}})}exports.CROSSxEIP1193Provider=H;exports.createCROSSxConnector=J;exports.crossxConnector=st;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("wagmi"),B=require("viem"),y=require("@nexus-cross/crossx-sdk-core");function Q(r){return parseInt(r.split(":")[1]??"1",10)}function R(r){return`eip155:${r}`}function M(r){return"0x"+r.toString(16)}function F(r){const t=r.startsWith("0x")?r.slice(2):r,i=new Uint8Array(t.length/2);for(let n=0;n<i.length;n++)i[n]=parseInt(t.substring(n*2,n*2+2),16);return new TextDecoder().decode(i)}class H{constructor(t,i=y.ChainId.ONE_MAINNET){this.sdk=t,this.listeners=new Map,this.walletIndex=0,this.currentAccounts=[],this.off=this.removeListener.bind(this),this.chainId=typeof i=="number"?i:Q(i),this.sdk.on("addressChanged",({address:n,index:u})=>{this.setWalletIndex(u),this.notifyAccountsChanged([n])})}_setWalletIndexChangeCallback(t){this.walletIndexChangeCallback=t}async request({method:t,params:i}){try{return await this._handleRequest(t,i)}catch(n){throw n instanceof y.CROSSxError&&n.code===y.ErrorCode.USER_REJECTED?Object.assign(new Error("User rejected the request"),{code:4001,data:n.details}):n}}async _handleRequest(t,i){var u;const n=i??[];switch(t){case"eth_requestAccounts":case"eth_accounts":{if(this.currentAccounts.length>0)return[...this.currentAccounts];const e=await this.sdk.getAddress();return e?[e.address]:[]}case"eth_chainId":return M(this.chainId);case"net_version":return String(this.chainId);case"personal_sign":{const[e]=n,o=e.startsWith("0x")?F(e):e;return(await this.sdk.signMessage(R(this.chainId),o,{index:this.walletIndex})).signature}case"eth_sign":{const[,e]=n,o=e.startsWith("0x")?F(e):e;return(await this.sdk.signMessage(R(this.chainId),o,{index:this.walletIndex})).signature}case"eth_signTypedData":case"eth_signTypedData_v3":case"eth_signTypedData_v4":{const[,e]=n,o=typeof e=="string"?JSON.parse(e):e,f=(u=o==null?void 0:o.domain)==null?void 0:u.chainId,x=f==null||f===0,p=x?0:Number(f),m={index:this.walletIndex};return(x?await this.sdk.signTypedDataOffchain(o,m):await this.sdk.signTypedData(R(p),o,m)).signature}case"eth_sendTransaction":{const[e]=n,o=R(this.chainId);return(await this.sdk.sendTransaction(o,{from:e.from,to:e.to,value:e.value,data:e.data,gasLimit:e.gasLimit??e.gas,gasPrice:e.gasPrice,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce!==void 0?parseInt(String(e.nonce),16):void 0,chainId:this.chainId},{index:this.walletIndex})).txHash}case"wallet_switchEthereumChain":{const[{chainId:e}]=n,o=parseInt(e,16);return o!==this.chainId&&(this.chainId=o,this.emit("chainChanged",M(o))),null}case"wallet_addEthereumChain":return null;default:return this.sdk.walletRpc(t,n,R(this.chainId))}}on(t,i){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(i),this}removeListener(t,i){var n;return(n=this.listeners.get(t))==null||n.delete(i),this}emit(t,...i){var n;(n=this.listeners.get(t))==null||n.forEach(u=>u(...i))}notifyAccountsChanged(t){this.currentAccounts=t,this.emit("accountsChanged",t)}notifyDisconnect(t){this.currentAccounts=[],this.walletIndex=0,this.emit("disconnect",t)}getCurrentChainId(){return this.chainId}setChainId(t){t!==this.chainId&&(this.chainId=t,this.emit("chainChanged",M(t)))}setWalletIndex(t){var i;this.walletIndex=t,(i=this.walletIndexChangeCallback)==null||i.call(this,t)}getWalletIndex(){return this.walletIndex}getCurrentAccounts(){return[...this.currentAccounts]}}function X(r){return typeof r=="number"?r:parseInt(r.split(":")[1]??"1",10)}const U="crossx-wallet-index";function V(){try{const r=typeof window<"u"?localStorage.getItem(U):null;return r&&Number(r)||0}catch{return 0}}function Z(r){try{typeof window<"u"&&localStorage.setItem(U,String(r))}catch{}}function K(){try{typeof window<"u"&&localStorage.removeItem(U)}catch{}}const j="crossx-wallet-address";function tt(){try{return typeof window<"u"?localStorage.getItem(j):null}catch{return null}}function et(r){try{typeof window<"u"&&localStorage.setItem(j,r)}catch{}}function nt(){try{typeof window<"u"&&localStorage.removeItem(j)}catch{}}function st(r){const{defaultChainId:t,getStoredWalletIndex:i,onWalletIndexChanged:n,getStoredWalletAddress:u,onWalletAddressChanged:e,clearStoredWalletAddress:o,openConnectOtherWallet:f,...x}=r;if(f){const m=x.connectOtherWallets,W=Array.isArray(m)&&m.length>0,A=x.showConnectOtherWallets===!0;!W&&!A&&(x.showConnectOtherWallets=!0)}const p=y.createCROSSxSDK(x);return J({sdk:p,defaultChainId:t,getStoredWalletIndex:i,onWalletIndexChanged:n,getStoredWalletAddress:u,onWalletAddressChanged:e,clearStoredWalletAddress:o,openConnectOtherWallet:f})}function J(r){const{sdk:t,defaultChainId:i=y.ChainId.ONE_MAINNET,getStoredWalletIndex:n=V,onWalletIndexChanged:u=Z,getStoredWalletAddress:e=tt,onWalletAddressChanged:o=et,clearStoredWalletAddress:f=nt,openConnectOtherWallet:x}=r,p=X(i);let m=null,W=!1,A=null,z=!1,v=!1,L=!1,S=null,D=!1;function N(I){const O=S;return O?(S=null,D=!1,O(I),!0):!1}function C(){return m||(m=new H(t,p),m._setWalletIndexChangeCallback(u)),m}return $.createConnector(I=>{function O(s){if(z)return;const l=C();l.on("accountsChanged",s.onAccountsChanged.bind(s)),l.on("chainChanged",s.onChainChanged.bind(s)),l.on("disconnect",s.onDisconnect.bind(s)),z=!0}function q(s){const l=C();l.notifyAccountsChanged([s]),I.emitter.emit("connect",{accounts:[s],chainId:l.getCurrentChainId()})}async function G(){if(!W)return A||(A=(async()=>{const s=n(),l=e()??void 0;await t.initialize({preferredWalletIndex:s,preferredWalletAddress:l}),t.on("addressChanged",({address:a,index:d})=>{if(v){D&&a&&t.isAuthenticated()&&S&&(C().setWalletIndex(d),o(a),N(a));return}const b=C();b.setWalletIndex(d),a&&(o(a),t.isAuthenticated()?q(a):b.notifyAccountsChanged([a]))}),t.on("authChanged",a=>{if(a.isAuthenticated&&a.source==="external"&&S){if(a.address){N(a.address);return}D=!0,t.getAddress().then(d=>{d!=null&&d.address&&t.isAuthenticated()&&N(d.address)}).catch(()=>{});return}if(!(v||L)){if(a.isAuthenticated){if(a.address){q(a.address);return}t.getAddress().then(d=>{d!=null&&d.address&&t.isAuthenticated()&&q(d.address)}).catch(()=>{});return}C().notifyDisconnect(),K(),f(),u(0),I.emitter.emit("disconnect")}}),x&&t.on("connectExternalWallet",x),W=!0})().finally(()=>{A=null}),A)}return{id:"crossx",name:y.WALLET_BRAND_NAME,type:"crossx",async setup(){await G(),O(this)},async connect({chainId:s,isReconnecting:l}={}){const a=s??p;v=!0;const d=new Promise(w=>{S=w}),b=this,Y=async()=>{await G(),O(b);const w=C();if(t.isAuthenticated()){const c=await t.getAddress();if(c)return w.setWalletIndex(c.index),w.notifyAccountsChanged([c.address]),{accounts:[c.address],chainId:a};if(l)throw new Error("CROSSx reconnect: authenticated session has no active wallet address");await t.signOut().catch(()=>{}),w.notifyDisconnect()}if(l)throw new Error("CROSSx reconnect: no authenticated session to restore");const _=e();let g;try{g=await t.signInWithCreate({preferredWalletAddress:_??void 0})}catch(c){throw c instanceof y.CROSSxError&&c.code===y.ErrorCode.EXTERNAL_WALLET_REQUESTED?(w.notifyDisconnect(),new B.UserRejectedRequestError(c)):(t.isAuthenticated()||(w.notifyDisconnect(),I.emitter.emit("disconnect")),c)}if(!g.success)throw new Error(g.error??"CROSSx sign-in failed");const h=g.address,E=g.addresses.map(c=>c.address).filter(c=>!h||c.toLowerCase()!==h.toLowerCase()),T=h?[h,...E]:E;if(T.length===0)throw new Error("No address found after sign-in");const k=g.addresses.find(c=>h&&c.address.toLowerCase()===h.toLowerCase()),P=(k==null?void 0:k.index)??0;return w.setWalletIndex(P),w.notifyAccountsChanged(T),h&&o(h),{accounts:T,chainId:a}};try{const w=Y();w.catch(()=>{});const _=await Promise.race([w.then(g=>({kind:"inner",value:g})),d.then(g=>({kind:"external",address:g}))]);if(_.kind==="external"){const g=C(),h=await t.getAddress().catch(()=>null),E=(h==null?void 0:h.address)??_.address,k=(await t.getAddresses().catch(()=>[])).map(c=>c.address).filter(c=>c.toLowerCase()!==E.toLowerCase()),P=[E,...k];return g.setWalletIndex((h==null?void 0:h.index)??0),g.notifyAccountsChanged(P),o(E),{accounts:P,chainId:a}}return _.value}finally{v=!1,S=null,D=!1}},async disconnect(){L=!0;try{const s=C();await t.signOut(),s.notifyDisconnect(),K(),f(),u(0),I.emitter.emit("disconnect")}finally{L=!1}},async getAccounts(){const l=C().getCurrentAccounts();if(l.length>0)return l;const a=await t.getAddress();return a?[a.address]:[]},async getChainId(){return C().getCurrentChainId()},async getProvider({chainId:s}={}){return C()},async isAuthorized(){return await G(),t.isAuthenticated()},async switchChain({chainId:s}){C().setChainId(s),I.emitter.emit("change",{chainId:s});const a=I.chains.find(d=>d.id===s);if(!a)throw new Error(`Chain ${s} is not configured`);return a},onAccountsChanged(s){s.length===0?I.emitter.emit("disconnect"):I.emitter.emit("change",{accounts:s})},onChainChanged(s){I.emitter.emit("change",{chainId:Number(s)})},onDisconnect(){I.emitter.emit("disconnect")}}})}exports.CROSSxEIP1193Provider=H;exports.createCROSSxConnector=J;exports.crossxConnector=st;
package/dist/index.d.ts CHANGED
@@ -6,9 +6,9 @@
6
6
  * 간편 모드:
7
7
  * import { crossxConnector } from '@nexus-cross/crossx-sdk-wagmi';
8
8
  * const config = createConfig({
9
- * chains: [crossMainnet],
9
+ * chains: [oneMainnet],
10
10
  * connectors: [crossxConnector({ projectId: 'YOUR_ID' })],
11
- * transports: { [crossMainnet.id]: http() },
11
+ * transports: { [oneMainnet.id]: http() },
12
12
  * });
13
13
  *
14
14
  * 고급 모드 (SDK 직접 주입):
@@ -16,9 +16,9 @@
16
16
  * import { createCROSSxSDK } from '@nexus-cross/crossx-sdk-core';
17
17
  * const sdk = createCROSSxSDK({ projectId: 'YOUR_ID' });
18
18
  * const config = createConfig({
19
- * chains: [crossMainnet],
19
+ * chains: [oneMainnet],
20
20
  * connectors: [createCROSSxConnector({ sdk })],
21
- * transports: { [crossMainnet.id]: http() },
21
+ * transports: { [oneMainnet.id]: http() },
22
22
  * });
23
23
  */
24
24
  export { crossxConnector, createCROSSxConnector } from './connector';
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ function F(r) {
17
17
  return new TextDecoder().decode(i);
18
18
  }
19
19
  class Z {
20
- constructor(t, i = K.CROSS_MAINNET) {
20
+ constructor(t, i = K.ONE_MAINNET) {
21
21
  this.sdk = t, this.listeners = /* @__PURE__ */ new Map(), this.walletIndex = 0, this.currentAccounts = [], this.off = this.removeListener.bind(this), this.chainId = typeof i == "number" ? i : V(i), this.sdk.on("addressChanged", ({ address: n, index: u }) => {
22
22
  this.setWalletIndex(u), this.notifyAccountsChanged([n]);
23
23
  });
@@ -186,8 +186,8 @@ function at() {
186
186
  function lt(r) {
187
187
  const { defaultChainId: t, getStoredWalletIndex: i, onWalletIndexChanged: n, getStoredWalletAddress: u, onWalletAddressChanged: e, clearStoredWalletAddress: c, openConnectOtherWallet: f, ...m } = r;
188
188
  if (f) {
189
- const x = m.connectOtherWallets, W = Array.isArray(x) && x.length > 0, p = m.showConnectOtherWallets === !0;
190
- !W && !p && (m.showConnectOtherWallets = !0);
189
+ const x = m.connectOtherWallets, E = Array.isArray(x) && x.length > 0, p = m.showConnectOtherWallets === !0;
190
+ !E && !p && (m.showConnectOtherWallets = !0);
191
191
  }
192
192
  const A = X(m);
193
193
  return it({ sdk: A, defaultChainId: t, getStoredWalletIndex: i, onWalletIndexChanged: n, getStoredWalletAddress: u, onWalletAddressChanged: e, clearStoredWalletAddress: c, openConnectOtherWallet: f });
@@ -195,7 +195,7 @@ function lt(r) {
195
195
  function it(r) {
196
196
  const {
197
197
  sdk: t,
198
- defaultChainId: i = K.CROSS_MAINNET,
198
+ defaultChainId: i = K.ONE_MAINNET,
199
199
  getStoredWalletIndex: n = et,
200
200
  onWalletIndexChanged: u = nt,
201
201
  getStoredWalletAddress: e = st,
@@ -203,16 +203,16 @@ function it(r) {
203
203
  clearStoredWalletAddress: f = at,
204
204
  openConnectOtherWallet: m
205
205
  } = r, A = tt(i);
206
- let x = null, W = !1, p = null, z = !1, D = !1, P = !1, y = null, R = !1;
206
+ let x = null, E = !1, p = null, z = !1, D = !1, P = !1, y = null, R = !1;
207
207
  function L(I) {
208
- const E = y;
209
- return E ? (y = null, R = !1, E(I), !0) : !1;
208
+ const W = y;
209
+ return W ? (y = null, R = !1, W(I), !0) : !1;
210
210
  }
211
211
  function C() {
212
212
  return x || (x = new Z(t, A), x._setWalletIndexChangeCallback(u)), x;
213
213
  }
214
214
  return $((I) => {
215
- function E(s) {
215
+ function W(s) {
216
216
  if (z) return;
217
217
  const l = C();
218
218
  l.on("accountsChanged", s.onAccountsChanged.bind(s)), l.on("chainChanged", s.onChainChanged.bind(s)), l.on("disconnect", s.onDisconnect.bind(s)), z = !0;
@@ -225,7 +225,7 @@ function it(r) {
225
225
  });
226
226
  }
227
227
  async function G() {
228
- if (!W)
228
+ if (!E)
229
229
  return p || (p = (async () => {
230
230
  const s = n(), l = e() ?? void 0;
231
231
  await t.initialize({ preferredWalletIndex: s, preferredWalletAddress: l }), t.on("addressChanged", ({ address: a, index: d }) => {
@@ -261,7 +261,7 @@ function it(r) {
261
261
  }
262
262
  C().notifyDisconnect(), j(), f(), u(0), I.emitter.emit("disconnect");
263
263
  }
264
- }), m && t.on("connectExternalWallet", m), W = !0;
264
+ }), m && t.on("connectExternalWallet", m), E = !0;
265
265
  })().finally(() => {
266
266
  p = null;
267
267
  }), p);
@@ -271,7 +271,7 @@ function it(r) {
271
271
  name: Q,
272
272
  type: "crossx",
273
273
  async setup() {
274
- await G(), E(this);
274
+ await G(), W(this);
275
275
  },
276
276
  // ── connect ─────────────────────────────────────────────────────────────
277
277
  async connect({ chainId: s, isReconnecting: l } = {}) {
@@ -280,7 +280,7 @@ function it(r) {
280
280
  const d = new Promise((w) => {
281
281
  y = w;
282
282
  }), T = this, Y = async () => {
283
- await G(), E(T);
283
+ await G(), W(T);
284
284
  const w = C();
285
285
  if (t.isAuthenticated()) {
286
286
  const o = await t.getAddress();
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAI9D,KAAK,aAAa,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAO9C,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,CAAC;CACtC;AA2BD,qBAAa,qBAAqB;IAQ9B,QAAQ,CAAC,GAAG,EAAE,SAAS;IAPzB,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,eAAe,CAAgB;IACvC,OAAO,CAAC,yBAAyB,CAAC,CAA0B;gBAGjD,GAAG,EAAE,SAAS,EACvB,cAAc,GAAE,MAAM,GAAG,MAA8B;IAazD,2CAA2C;IAC3C,6BAA6B,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAM1D,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,uBAAuB,GAAG,OAAO,CAAC,OAAO,CAAC;YAe9D,cAAc;IAuG5B,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;IAQhD,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;IAK5D,GAAG,UALmB,MAAM,YAAY,aAAa,KAAG,IAAI,CAKvB;IAErC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM7C,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI;IAK/C,gBAAgB,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;IAMrC,iBAAiB,IAAI,MAAM;IAI3B,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAO5B;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKnC,cAAc,IAAI,MAAM;IAIxB,kBAAkB,IAAI,MAAM,EAAE;CAG/B"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAI9D,KAAK,aAAa,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAO9C,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,CAAC;CACtC;AA2BD,qBAAa,qBAAqB;IAQ9B,QAAQ,CAAC,GAAG,EAAE,SAAS;IAPzB,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,eAAe,CAAgB;IACvC,OAAO,CAAC,yBAAyB,CAAC,CAA0B;gBAGjD,GAAG,EAAE,SAAS,EACvB,cAAc,GAAE,MAAM,GAAG,MAA4B;IAavD,2CAA2C;IAC3C,6BAA6B,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAM1D,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,uBAAuB,GAAG,OAAO,CAAC,OAAO,CAAC;YAe9D,cAAc;IAuG5B,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;IAQhD,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;IAK5D,GAAG,UALmB,MAAM,YAAY,aAAa,KAAG,IAAI,CAKvB;IAErC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM7C,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI;IAK/C,gBAAgB,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;IAMrC,iBAAiB,IAAI,MAAM;IAI3B,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAO5B;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKnC,cAAc,IAAI,MAAM;IAIxB,kBAAkB,IAAI,MAAM,EAAE;CAG/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexus-cross/crossx-sdk-wagmi",
3
- "version": "2.3.10-beta.6",
3
+ "version": "2.3.10",
4
4
  "description": "CROSSx SDK wagmi Connector — OAuth 임베디드 지갑을 wagmi에 통합",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -18,7 +18,7 @@
18
18
  ],
19
19
  "sideEffects": false,
20
20
  "dependencies": {
21
- "@nexus-cross/crossx-sdk-core": "^2.3.10-beta.6"
21
+ "@nexus-cross/crossx-sdk-core": "^2.3.10"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@nexus-cross/crossx-sdk-core": "^2.0.0",