@nexus-cross/crossx-sdk-wagmi 2.3.3 → 2.3.7-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.cjs +1 -1
- package/dist/index.js +59 -59
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("wagmi"),z=require("viem"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("wagmi"),z=require("viem"),x=require("@nexus-cross/crossx-sdk-core");function F(s){return parseInt(s.split(":")[1]??"1",10)}function A(s){return`eip155:${s}`}function D(s){return"0x"+s.toString(16)}function N(s){const e=s.startsWith("0x")?s.slice(2):s,r=new Uint8Array(e.length/2);for(let n=0;n<r.length;n++)r[n]=parseInt(e.substring(n*2,n*2+2),16);return new TextDecoder().decode(r)}class G{constructor(e,r=x.ChainId.CROSS_MAINNET){this.sdk=e,this.listeners=new Map,this.walletIndex=0,this.currentAccounts=[],this.off=this.removeListener.bind(this),this.chainId=typeof r=="number"?r:F(r),this.sdk.on("addressChanged",({address:n,index:d})=>{this.setWalletIndex(d),this.notifyAccountsChanged([n])})}_setWalletIndexChangeCallback(e){this.walletIndexChangeCallback=e}async request({method:e,params:r}){try{return await this._handleRequest(e,r)}catch(n){throw n instanceof x.CROSSxError&&n.code===x.ErrorCode.USER_REJECTED?Object.assign(new Error("User rejected the request"),{code:4001,data:n.details}):n}}async _handleRequest(e,r){var d;const n=r??[];switch(e){case"eth_requestAccounts":case"eth_accounts":{if(this.currentAccounts.length>0)return[...this.currentAccounts];const t=await this.sdk.getAddress();return t?[t.address]:[]}case"eth_chainId":return D(this.chainId);case"net_version":return String(this.chainId);case"personal_sign":{const[t]=n,c=t.startsWith("0x")?N(t):t;return(await this.sdk.signMessage(A(this.chainId),c,{index:this.walletIndex})).signature}case"eth_sign":{const[,t]=n,c=t.startsWith("0x")?N(t):t;return(await this.sdk.signMessage(A(this.chainId),c,{index:this.walletIndex})).signature}case"eth_signTypedData":case"eth_signTypedData_v3":case"eth_signTypedData_v4":{const[,t]=n,c=typeof t=="string"?JSON.parse(t):t,l=(d=c==null?void 0:c.domain)==null?void 0:d.chainId,u=l==null||l===0,m=u?0:Number(l),f={index:this.walletIndex};return(u?await this.sdk.signTypedDataOffchain(c,f):await this.sdk.signTypedData(A(m),c,f)).signature}case"eth_sendTransaction":{const[t]=n,c=A(this.chainId);return(await this.sdk.sendTransaction(c,{from:t.from,to:t.to,value:t.value,data:t.data,gasLimit:t.gasLimit??t.gas,gasPrice:t.gasPrice,maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas,nonce:t.nonce!==void 0?parseInt(String(t.nonce),16):void 0,chainId:this.chainId},{index:this.walletIndex})).txHash}case"wallet_switchEthereumChain":{const[{chainId:t}]=n,c=parseInt(t,16);return c!==this.chainId&&(this.chainId=c,this.emit("chainChanged",D(c))),null}case"wallet_addEthereumChain":return null;default:return this.sdk.walletRpc(e,n,A(this.chainId))}}on(e,r){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(r),this}removeListener(e,r){var n;return(n=this.listeners.get(e))==null||n.delete(r),this}emit(e,...r){var n;(n=this.listeners.get(e))==null||n.forEach(d=>d(...r))}notifyAccountsChanged(e){this.currentAccounts=e,this.emit("accountsChanged",e)}notifyDisconnect(e){this.currentAccounts=[],this.walletIndex=0,this.emit("disconnect",e)}getCurrentChainId(){return this.chainId}setChainId(e){e!==this.chainId&&(this.chainId=e,this.emit("chainChanged",D(e)))}setWalletIndex(e){var r;this.walletIndex=e,(r=this.walletIndexChangeCallback)==null||r.call(this,e)}getWalletIndex(){return this.walletIndex}getCurrentAccounts(){return[...this.currentAccounts]}}function K(s){return typeof s=="number"?s:parseInt(s.split(":")[1]??"1",10)}const b="crossx-wallet-index";function H(){try{const s=typeof window<"u"?localStorage.getItem(b):null;return s&&Number(s)||0}catch{return 0}}function J(s){try{typeof window<"u"&&localStorage.setItem(b,String(s))}catch{}}function q(){try{typeof window<"u"&&localStorage.removeItem(b)}catch{}}const k="crossx-wallet-address";function Y(){try{return typeof window<"u"?localStorage.getItem(k):null}catch{return null}}function $(s){try{typeof window<"u"&&localStorage.setItem(k,s)}catch{}}function B(){try{typeof window<"u"&&localStorage.removeItem(k)}catch{}}function Q(s){const{defaultChainId:e,getStoredWalletIndex:r,onWalletIndexChanged:n,getStoredWalletAddress:d,onWalletAddressChanged:t,clearStoredWalletAddress:c,openConnectOtherWallet:l,...u}=s;if(l){const f=u.connectOtherWallets,S=Array.isArray(f)&&f.length>0,y=u.showConnectOtherWallets===!0;!S&&!y&&(u.showConnectOtherWallets=!0)}const m=x.createCROSSxSDK(u);return M({sdk:m,defaultChainId:e,getStoredWalletIndex:r,onWalletIndexChanged:n,getStoredWalletAddress:d,onWalletAddressChanged:t,clearStoredWalletAddress:c,openConnectOtherWallet:l})}function M(s){const{sdk:e,defaultChainId:r=x.ChainId.CROSS_MAINNET,getStoredWalletIndex:n=H,onWalletIndexChanged:d=J,getStoredWalletAddress:t=Y,onWalletAddressChanged:c=$,clearStoredWalletAddress:l=B,openConnectOtherWallet:u}=s,m=K(r);let f=null,S=!1,y=null,T=!1,E=!1,O=!1;function g(){return f||(f=new G(e,m),f._setWalletIndexChangeCallback(d)),f}return j.createConnector(C=>{function P(a){if(T)return;const h=g();h.on("accountsChanged",a.onAccountsChanged.bind(a)),h.on("chainChanged",a.onChainChanged.bind(a)),h.on("disconnect",a.onDisconnect.bind(a)),T=!0}async function _(){if(!S)return y||(y=(async()=>{const a=n(),h=t()??void 0;await e.initialize({preferredWalletIndex:a,preferredWalletAddress:h}),e.on("addressChanged",({address:i,index:I})=>{if(E)return;const W=g();W.setWalletIndex(I),i&&(W.notifyAccountsChanged([i]),c(i))}),e.on("authChanged",i=>{if(!(E||O))if(i.isAuthenticated&&i.address){const I=g();I.notifyAccountsChanged([i.address]),C.emitter.emit("connect",{accounts:[i.address],chainId:I.getCurrentChainId()})}else i.isAuthenticated||(g().notifyDisconnect(),q(),l(),d(0),C.emitter.emit("disconnect"))}),u&&e.on("connectExternalWallet",u),S=!0})().finally(()=>{y=null}),y)}return{id:"crossx",name:x.WALLET_BRAND_NAME,type:"crossx",async setup(){await _(),P(this)},async connect({chainId:a,isReconnecting:h}={}){await _(),P(this);const i=g(),I=a??m;E=!0;try{if(e.isAuthenticated()){const o=await e.getAddress();if(o)return i.setWalletIndex(o.index),i.notifyAccountsChanged([o.address]),{accounts:[o.address],chainId:I};if(h)throw new Error("CROSSx reconnect: authenticated session has no active wallet address");await e.signOut().catch(()=>{}),i.notifyDisconnect()}if(h)throw new Error("CROSSx reconnect: no authenticated session to restore");const W=t();let p;try{p=await e.signInWithCreate({preferredWalletAddress:W??void 0})}catch(o){throw o instanceof x.CROSSxError&&o.code===x.ErrorCode.EXTERNAL_WALLET_REQUESTED?(i.notifyDisconnect(),new z.UserRejectedRequestError(o)):(e.isAuthenticated()||(i.notifyDisconnect(),C.emitter.emit("disconnect")),o)}if(!p.success)throw new Error(p.error??"CROSSx sign-in failed");const w=p.address,L=p.addresses.map(o=>o.address).filter(o=>!w||o.toLowerCase()!==w.toLowerCase()),R=w?[w,...L]:L;if(R.length===0)throw new Error("No address found after sign-in");const v=p.addresses.find(o=>w&&o.address.toLowerCase()===w.toLowerCase()),U=(v==null?void 0:v.index)??0;return i.setWalletIndex(U),i.notifyAccountsChanged(R),w&&c(w),{accounts:R,chainId:I}}finally{E=!1}},async disconnect(){O=!0;try{const a=g();await e.signOut(),a.notifyDisconnect(),q(),l(),d(0),C.emitter.emit("disconnect")}finally{O=!1}},async getAccounts(){const h=g().getCurrentAccounts();if(h.length>0)return h;const i=await e.getAddress();return i?[i.address]:[]},async getChainId(){return g().getCurrentChainId()},async getProvider({chainId:a}={}){return g()},async isAuthorized(){return await _(),e.isAuthenticated()},async switchChain({chainId:a}){g().setChainId(a),C.emitter.emit("change",{chainId:a});const i=C.chains.find(I=>I.id===a);if(!i)throw new Error(`Chain ${a} is not configured`);return i},onAccountsChanged(a){a.length===0?C.emitter.emit("disconnect"):C.emitter.emit("change",{accounts:a})},onChainChanged(a){C.emitter.emit("change",{chainId:Number(a)})},onDisconnect(){C.emitter.emit("disconnect")}}})}exports.CROSSxEIP1193Provider=G;exports.createCROSSxConnector=M;exports.crossxConnector=Q;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createConnector as z } from "wagmi";
|
|
2
2
|
import { UserRejectedRequestError as F } from "viem";
|
|
3
|
-
import { ChainId as G, CROSSxError as q, ErrorCode as
|
|
4
|
-
function
|
|
3
|
+
import { ChainId as G, CROSSxError as q, ErrorCode as M, WALLET_BRAND_NAME as j, createCROSSxSDK as K } from "@nexus-cross/crossx-sdk-core";
|
|
4
|
+
function H(s) {
|
|
5
5
|
return parseInt(s.split(":")[1] ?? "1", 10);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function A(s) {
|
|
8
8
|
return `eip155:${s}`;
|
|
9
9
|
}
|
|
10
10
|
function R(s) {
|
|
@@ -16,9 +16,9 @@ function L(s) {
|
|
|
16
16
|
r[n] = parseInt(t.substring(n * 2, n * 2 + 2), 16);
|
|
17
17
|
return new TextDecoder().decode(r);
|
|
18
18
|
}
|
|
19
|
-
class
|
|
19
|
+
class J {
|
|
20
20
|
constructor(t, r = G.CROSS_MAINNET) {
|
|
21
|
-
this.sdk = t, this.listeners = /* @__PURE__ */ new Map(), this.walletIndex = 0, this.currentAccounts = [], this.off = this.removeListener.bind(this), this.chainId = typeof r == "number" ? r :
|
|
21
|
+
this.sdk = t, this.listeners = /* @__PURE__ */ new Map(), this.walletIndex = 0, this.currentAccounts = [], this.off = this.removeListener.bind(this), this.chainId = typeof r == "number" ? r : H(r), this.sdk.on("addressChanged", ({ address: n, index: d }) => {
|
|
22
22
|
this.setWalletIndex(d), this.notifyAccountsChanged([n]);
|
|
23
23
|
});
|
|
24
24
|
}
|
|
@@ -31,7 +31,7 @@ class H {
|
|
|
31
31
|
try {
|
|
32
32
|
return await this._handleRequest(t, r);
|
|
33
33
|
} catch (n) {
|
|
34
|
-
throw n instanceof q && n.code ===
|
|
34
|
+
throw n instanceof q && n.code === M.USER_REJECTED ? Object.assign(
|
|
35
35
|
new Error("User rejected the request"),
|
|
36
36
|
{ code: 4001, data: n.details }
|
|
37
37
|
) : n;
|
|
@@ -55,7 +55,7 @@ class H {
|
|
|
55
55
|
case "personal_sign": {
|
|
56
56
|
const [e] = n, c = e.startsWith("0x") ? L(e) : e;
|
|
57
57
|
return (await this.sdk.signMessage(
|
|
58
|
-
|
|
58
|
+
A(this.chainId),
|
|
59
59
|
c,
|
|
60
60
|
{ index: this.walletIndex }
|
|
61
61
|
)).signature;
|
|
@@ -63,7 +63,7 @@ class H {
|
|
|
63
63
|
case "eth_sign": {
|
|
64
64
|
const [, e] = n, c = e.startsWith("0x") ? L(e) : e;
|
|
65
65
|
return (await this.sdk.signMessage(
|
|
66
|
-
|
|
66
|
+
A(this.chainId),
|
|
67
67
|
c,
|
|
68
68
|
{ index: this.walletIndex }
|
|
69
69
|
)).signature;
|
|
@@ -72,10 +72,10 @@ class H {
|
|
|
72
72
|
case "eth_signTypedData_v3":
|
|
73
73
|
case "eth_signTypedData_v4": {
|
|
74
74
|
const [, e] = n, c = typeof e == "string" ? JSON.parse(e) : e, l = (d = c == null ? void 0 : c.domain) == null ? void 0 : d.chainId, u = l == null || l === 0, p = u ? 0 : Number(l), f = { index: this.walletIndex };
|
|
75
|
-
return (u ? await this.sdk.signTypedDataOffchain(c, f) : await this.sdk.signTypedData(
|
|
75
|
+
return (u ? await this.sdk.signTypedDataOffchain(c, f) : await this.sdk.signTypedData(A(p), c, f)).signature;
|
|
76
76
|
}
|
|
77
77
|
case "eth_sendTransaction": {
|
|
78
|
-
const [e] = n, c =
|
|
78
|
+
const [e] = n, c = A(this.chainId);
|
|
79
79
|
return (await this.sdk.sendTransaction(c, {
|
|
80
80
|
from: e.from,
|
|
81
81
|
to: e.to,
|
|
@@ -96,7 +96,7 @@ class H {
|
|
|
96
96
|
case "wallet_addEthereumChain":
|
|
97
97
|
return null;
|
|
98
98
|
default:
|
|
99
|
-
return this.sdk.walletRpc(t, n,
|
|
99
|
+
return this.sdk.walletRpc(t, n, A(this.chainId));
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
// ── EIP-1193 이벤트 ───────────────────────────────────────────────────────
|
|
@@ -139,11 +139,11 @@ class H {
|
|
|
139
139
|
return [...this.currentAccounts];
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function Y(s) {
|
|
143
143
|
return typeof s == "number" ? s : parseInt(s.split(":")[1] ?? "1", 10);
|
|
144
144
|
}
|
|
145
145
|
const k = "crossx-wallet-index";
|
|
146
|
-
function
|
|
146
|
+
function $() {
|
|
147
147
|
try {
|
|
148
148
|
const s = typeof window < "u" ? localStorage.getItem(k) : null;
|
|
149
149
|
return s && Number(s) || 0;
|
|
@@ -151,7 +151,7 @@ function Y() {
|
|
|
151
151
|
return 0;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function B(s) {
|
|
155
155
|
try {
|
|
156
156
|
typeof window < "u" && localStorage.setItem(k, String(s));
|
|
157
157
|
} catch {
|
|
@@ -163,66 +163,66 @@ function N() {
|
|
|
163
163
|
} catch {
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
const
|
|
166
|
+
const T = "crossx-wallet-address";
|
|
167
167
|
function Q() {
|
|
168
168
|
try {
|
|
169
|
-
return typeof window < "u" ? localStorage.getItem(
|
|
169
|
+
return typeof window < "u" ? localStorage.getItem(T) : null;
|
|
170
170
|
} catch {
|
|
171
171
|
return null;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
function X(s) {
|
|
175
175
|
try {
|
|
176
|
-
typeof window < "u" && localStorage.setItem(
|
|
176
|
+
typeof window < "u" && localStorage.setItem(T, s);
|
|
177
177
|
} catch {
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function V() {
|
|
181
181
|
try {
|
|
182
|
-
typeof window < "u" && localStorage.removeItem(
|
|
182
|
+
typeof window < "u" && localStorage.removeItem(T);
|
|
183
183
|
} catch {
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function st(s) {
|
|
187
187
|
const { defaultChainId: t, getStoredWalletIndex: r, onWalletIndexChanged: n, getStoredWalletAddress: d, onWalletAddressChanged: e, clearStoredWalletAddress: c, openConnectOtherWallet: l, ...u } = s;
|
|
188
188
|
if (l) {
|
|
189
|
-
const f = u.connectOtherWallets,
|
|
190
|
-
!
|
|
189
|
+
const f = u.connectOtherWallets, x = Array.isArray(f) && f.length > 0, m = u.showConnectOtherWallets === !0;
|
|
190
|
+
!x && !m && (u.showConnectOtherWallets = !0);
|
|
191
191
|
}
|
|
192
|
-
const p =
|
|
193
|
-
return
|
|
192
|
+
const p = K(u);
|
|
193
|
+
return Z({ sdk: p, defaultChainId: t, getStoredWalletIndex: r, onWalletIndexChanged: n, getStoredWalletAddress: d, onWalletAddressChanged: e, clearStoredWalletAddress: c, openConnectOtherWallet: l });
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function Z(s) {
|
|
196
196
|
const {
|
|
197
197
|
sdk: t,
|
|
198
198
|
defaultChainId: r = G.CROSS_MAINNET,
|
|
199
|
-
getStoredWalletIndex: n =
|
|
200
|
-
onWalletIndexChanged: d =
|
|
199
|
+
getStoredWalletIndex: n = $,
|
|
200
|
+
onWalletIndexChanged: d = B,
|
|
201
201
|
getStoredWalletAddress: e = Q,
|
|
202
202
|
onWalletAddressChanged: c = X,
|
|
203
|
-
clearStoredWalletAddress: l =
|
|
203
|
+
clearStoredWalletAddress: l = V,
|
|
204
204
|
openConnectOtherWallet: u
|
|
205
|
-
} = s, p =
|
|
206
|
-
let f = null,
|
|
205
|
+
} = s, p = Y(r);
|
|
206
|
+
let f = null, x = !1, m = null, b = !1, S = !1, E = !1;
|
|
207
207
|
function g() {
|
|
208
|
-
return f || (f = new
|
|
208
|
+
return f || (f = new J(t, p), f._setWalletIndexChangeCallback(d)), f;
|
|
209
209
|
}
|
|
210
210
|
return z((C) => {
|
|
211
|
-
function
|
|
212
|
-
if (
|
|
211
|
+
function v(a) {
|
|
212
|
+
if (b) return;
|
|
213
213
|
const h = g();
|
|
214
|
-
h.on("accountsChanged", a.onAccountsChanged.bind(a)), h.on("chainChanged", a.onChainChanged.bind(a)), h.on("disconnect", a.onDisconnect.bind(a)),
|
|
214
|
+
h.on("accountsChanged", a.onAccountsChanged.bind(a)), h.on("chainChanged", a.onChainChanged.bind(a)), h.on("disconnect", a.onDisconnect.bind(a)), b = !0;
|
|
215
215
|
}
|
|
216
|
-
async function
|
|
217
|
-
if (!
|
|
216
|
+
async function _() {
|
|
217
|
+
if (!x)
|
|
218
218
|
return m || (m = (async () => {
|
|
219
219
|
const a = n(), h = e() ?? void 0;
|
|
220
220
|
await t.initialize({ preferredWalletIndex: a, preferredWalletAddress: h }), t.on("addressChanged", ({ address: i, index: I }) => {
|
|
221
|
-
if (
|
|
221
|
+
if (S) return;
|
|
222
222
|
const W = g();
|
|
223
223
|
W.setWalletIndex(I), i && (W.notifyAccountsChanged([i]), c(i));
|
|
224
224
|
}), t.on("authChanged", (i) => {
|
|
225
|
-
if (!(
|
|
225
|
+
if (!(S || E))
|
|
226
226
|
if (i.isAuthenticated && i.address) {
|
|
227
227
|
const I = g();
|
|
228
228
|
I.notifyAccountsChanged([i.address]), C.emitter.emit("connect", {
|
|
@@ -230,23 +230,23 @@ function V(s) {
|
|
|
230
230
|
chainId: I.getCurrentChainId()
|
|
231
231
|
});
|
|
232
232
|
} else i.isAuthenticated || (g().notifyDisconnect(), N(), l(), d(0), C.emitter.emit("disconnect"));
|
|
233
|
-
}), u && t.on("connectExternalWallet", u),
|
|
233
|
+
}), u && t.on("connectExternalWallet", u), x = !0;
|
|
234
234
|
})().finally(() => {
|
|
235
235
|
m = null;
|
|
236
236
|
}), m);
|
|
237
237
|
}
|
|
238
238
|
return {
|
|
239
239
|
id: "crossx",
|
|
240
|
-
name:
|
|
240
|
+
name: j,
|
|
241
241
|
type: "crossx",
|
|
242
242
|
async setup() {
|
|
243
|
-
await
|
|
243
|
+
await _(), v(this);
|
|
244
244
|
},
|
|
245
245
|
// ── connect ─────────────────────────────────────────────────────────────
|
|
246
246
|
async connect({ chainId: a, isReconnecting: h } = {}) {
|
|
247
|
-
await
|
|
247
|
+
await _(), v(this);
|
|
248
248
|
const i = g(), I = a ?? p;
|
|
249
|
-
|
|
249
|
+
S = !0;
|
|
250
250
|
try {
|
|
251
251
|
if (t.isAuthenticated()) {
|
|
252
252
|
const o = await t.getAddress();
|
|
@@ -266,29 +266,29 @@ function V(s) {
|
|
|
266
266
|
if (h)
|
|
267
267
|
throw new Error("CROSSx reconnect: no authenticated session to restore");
|
|
268
268
|
const W = e();
|
|
269
|
-
let
|
|
269
|
+
let y;
|
|
270
270
|
try {
|
|
271
|
-
|
|
271
|
+
y = await t.signInWithCreate({
|
|
272
272
|
preferredWalletAddress: W ?? void 0
|
|
273
273
|
});
|
|
274
274
|
} catch (o) {
|
|
275
|
-
throw o instanceof q && o.code ===
|
|
275
|
+
throw o instanceof q && o.code === M.EXTERNAL_WALLET_REQUESTED ? (i.notifyDisconnect(), new F(o)) : (t.isAuthenticated() || (i.notifyDisconnect(), C.emitter.emit("disconnect")), o);
|
|
276
276
|
}
|
|
277
|
-
if (!
|
|
278
|
-
throw new Error(
|
|
279
|
-
const w =
|
|
280
|
-
if (
|
|
277
|
+
if (!y.success)
|
|
278
|
+
throw new Error(y.error ?? "CROSSx sign-in failed");
|
|
279
|
+
const w = y.address, P = y.addresses.map((o) => o.address).filter((o) => !w || o.toLowerCase() !== w.toLowerCase()), O = w ? [w, ...P] : P;
|
|
280
|
+
if (O.length === 0)
|
|
281
281
|
throw new Error("No address found after sign-in");
|
|
282
|
-
const D =
|
|
282
|
+
const D = y.addresses.find(
|
|
283
283
|
(o) => w && o.address.toLowerCase() === w.toLowerCase()
|
|
284
|
-
),
|
|
285
|
-
return i.setWalletIndex(
|
|
286
|
-
accounts:
|
|
284
|
+
), U = (D == null ? void 0 : D.index) ?? 0;
|
|
285
|
+
return i.setWalletIndex(U), i.notifyAccountsChanged(O), w && c(w), {
|
|
286
|
+
accounts: O,
|
|
287
287
|
chainId: I
|
|
288
288
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
289
289
|
};
|
|
290
290
|
} finally {
|
|
291
|
-
|
|
291
|
+
S = !1;
|
|
292
292
|
}
|
|
293
293
|
},
|
|
294
294
|
// ── disconnect ──────────────────────────────────────────────────────────
|
|
@@ -318,7 +318,7 @@ function V(s) {
|
|
|
318
318
|
},
|
|
319
319
|
// ── isAuthorized ────────────────────────────────────────────────────────
|
|
320
320
|
async isAuthorized() {
|
|
321
|
-
return await
|
|
321
|
+
return await _(), t.isAuthenticated();
|
|
322
322
|
},
|
|
323
323
|
// ── switchChain ─────────────────────────────────────────────────────────
|
|
324
324
|
async switchChain({ chainId: a }) {
|
|
@@ -346,7 +346,7 @@ function V(s) {
|
|
|
346
346
|
});
|
|
347
347
|
}
|
|
348
348
|
export {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
349
|
+
J as CROSSxEIP1193Provider,
|
|
350
|
+
Z as createCROSSxConnector,
|
|
351
|
+
st as crossxConnector
|
|
352
352
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexus-cross/crossx-sdk-wagmi",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.7-beta.1",
|
|
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.
|
|
21
|
+
"@nexus-cross/crossx-sdk-core": "^2.3.7-beta.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@nexus-cross/crossx-sdk-core": "^2.0.0",
|