miniwallet 0.1.5 → 0.1.7

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.
@@ -74,16 +74,16 @@ function m({ children: e, chains: n = [] }) {
74
74
  let { id: t } = e;
75
75
  try {
76
76
  console.log("eip6963Providers: ", S);
77
- let n = S[t];
78
- if (!n) {
77
+ let e = S[t];
78
+ if (!e) {
79
79
  alert("请安装钱包");
80
80
  return;
81
81
  }
82
- x(e), console.log("provider: ", n);
83
- let r = await n.request({ method: "eth_requestAccounts" });
84
- console.log("accounts: ", r), console.log("provider.chainId: ", n.chainId);
85
- let i = parseInt(n.chainId, 16);
86
- l(r[0]), h(t), _(i), localStorage.setItem("miniwallet:lastWalletId", t), x(null);
82
+ console.log("provider: ", e);
83
+ let n = await e.request({ method: "eth_requestAccounts" });
84
+ console.log("accounts: ", n), console.log("provider.chainId: ", e.chainId);
85
+ let r = parseInt(e.chainId, 16);
86
+ l(n[0]), h(t), _(r), localStorage.setItem("miniwallet:lastWalletId", t);
87
87
  } catch (e) {
88
88
  console.log("error: ", e);
89
89
  let t = e, n = t?.code ?? "", r = t?.message ?? "";
@@ -171,7 +171,7 @@ function m({ children: e, chains: n = [] }) {
171
171
  }, []), r(() => {
172
172
  g && N();
173
173
  }, [N, g]), r(() => {
174
- if (!T?.on) return;
174
+ if (!D || !T?.on) return;
175
175
  let e = (e) => {
176
176
  console.log("ChainChanged chainId: ", e), _(parseInt(e, 16));
177
177
  }, t = (e) => {
@@ -180,7 +180,7 @@ function m({ children: e, chains: n = [] }) {
180
180
  return console.log("Listen chainChanged and accountsChanged"), T.on("chainChanged", e), T.on("accountsChanged", t), () => {
181
181
  console.log("RemoveListener chainChanged and accountsChanged"), T.removeListener("chainChanged", e), T.removeListener("accountsChanged", t);
182
182
  };
183
- }, [T]), r(() => {
183
+ }, [T, D]), r(() => {
184
184
  if (!s) return;
185
185
  let e = setInterval(N, 1e4);
186
186
  return () => clearInterval(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miniwallet",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "React wallet connect button with multi-wallet support via EIP-6963",
5
5
  "type": "module",
6
6
  "main": "./dist/miniwallet.js",